I just started doing some low level code for my ipaq 4700 and Im getting some curious errors from microsoft's ARMASM compiler.
Coming from a gameboy advance background, I was used to doing c-like switch statements in arm assembler with the following (gas syntzx for gcc):
this is a very standard way of doing switch statements in gameboy advanced development, but for some reason microsoft doesnt seem to agree with that view. When I do an asm listing of a switch statement in C, the bx <reg> method is changed with an add pc, pc, <reg> scheme. Acceptable, but incredibly difficult to code by hand, since now instead of labels, I have to code relative offsets. Might be ok for a simple switch, but in the routine I'm writing I need to juggle quite a few complex switch statements and I sure as hell am not going to do the offset arithmetic by hand.
Why is the BX instruction causing link errors? When I comment it out, not a peep from the compiler. The moment it appears, I get all kinds of noise about mixed arm/thumb compiled modules. And what happened to the thumb instruction set for that matter..if bx cannot be used, how the hell do you get to the 16bit instructions..or do they even exist on the pxa270? I thought all arm processors do both instructions sets, regardless of intel's enhancements.
When I switch the project to thumb compilation, the error with the bx instruction goes away, but the device now complains that the application is not valid. Im getting a bad feeling because if I cannot use the BX or thumb instructions, then all my work is for nothing...I need full access to all instructions, not just a subset.
If there is an alternative ide/compiler suite (eg GCC) I can use that does proper thumb/arm interop calls, please let me know, Im getting the feeling eVC did not get it right.
Coming from a gameboy advance background, I was used to doing c-like switch statements in arm assembler with the following (gas syntzx for gcc):
- Code:
ldr r2, jumplist
ldr r3, [r2, r0, lsl #2]
bx r3 ; branch to case statement
jumplist:
dd jump1
dd jump2
dd jump3
.... so on
jump1:
... code
jump2:
... more code
this is a very standard way of doing switch statements in gameboy advanced development, but for some reason microsoft doesnt seem to agree with that view. When I do an asm listing of a switch statement in C, the bx <reg> method is changed with an add pc, pc, <reg> scheme. Acceptable, but incredibly difficult to code by hand, since now instead of labels, I have to code relative offsets. Might be ok for a simple switch, but in the routine I'm writing I need to juggle quite a few complex switch statements and I sure as hell am not going to do the offset arithmetic by hand.
Why is the BX instruction causing link errors? When I comment it out, not a peep from the compiler. The moment it appears, I get all kinds of noise about mixed arm/thumb compiled modules. And what happened to the thumb instruction set for that matter..if bx cannot be used, how the hell do you get to the 16bit instructions..or do they even exist on the pxa270? I thought all arm processors do both instructions sets, regardless of intel's enhancements.
When I switch the project to thumb compilation, the error with the bx instruction goes away, but the device now complains that the application is not valid. Im getting a bad feeling because if I cannot use the BX or thumb instructions, then all my work is for nothing...I need full access to all instructions, not just a subset.
If there is an alternative ide/compiler suite (eg GCC) I can use that does proper thumb/arm interop calls, please let me know, Im getting the feeling eVC did not get it right.