I want to simulate the below ARM assembly program on uvision3:
Code:
AREA HelloW, CODE, READONLY
SWI_WriteC EQU &0
SWI_Exit EQU &11
ENTRY
START ADR r1,TEXT
LOOP LDRB r0,[r1],#1
CMP r0,#0
SWINE SWI_WriteC
BNE LOOP
SWI SWI_Exit
TEXT = "Hello,World!",&0a,&0d,0
END
The target is LPC2129 but i just want to run it on the simulator. The problem is when i use the default startup.s file, i get the following error on build: Build target 'Target 1'
linking...
HelloWorld.axf: Warning: L6665W: Neither Lib$$Request$$armlib Lib$$Request$$cpplib defined, not searching ARM libraries.
HelloWorld.axf: Error: L6218E: Undefined symbol __main (referred from startup.o).
HelloWorld.axf: Error: L6218E: Undefined symbol __use_two_region_memory (referred from startup.o).
Target not created
If i try to build the source without the startup, i get the following error: Build target 'Target 1'
assembling Main.S...
linking...
HelloWorld.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.
"HelloWorld.axf" - 1 Error(s), 0 Warning(s).
My questions:
1)Should i include the startup.s file eventhough i only want to simulate the code on KEIL
2)Any inputs on how i can remove the errors appearing above
Do you only have two source files in your project? startup.s and <hello>.s?
startup.s makes reference to external symbols, after it does the initial setup it branches main, so a function by that name should be in one of the source files.
To resolve the main symbol, create a C file with int main() / void main() or add a new assembler subroutine called main that just loops.
As for the other symbol I'm not sure, perhaps look at the reference project where you picked startup.s from. I might be a #define or EQU constant that is missing.
You can't use the semihosting SWI calls in the uVision debugger. Take out the SWI instructions and change the AREA sectionname to RESET and your code will build and run in the debugger. You'll see R0 getting loaded and compared, not very interesting but a sort of 'Hello World' I suppose.
Code:
AREA RESET, CODE, READONLY
ENTRY
ADR r1, TEXT
LOOP LDRB r0, [r1], #1
CMP r0, #0
BNE LOOP
B .
TEXT = "Hello World!", &0a, &0d, 0
END
You can't use the semihosting SWI calls in the uVision debugger. Take out the SWI instructions and change the AREA sectionname to RESET and your code will build and run in the debugger. You'll see R0 getting loaded and compared, not very interesting but a sort of 'Hello World' I suppose.
Code:
AREA RESET, CODE, READONLY
ENTRY
ADR r1, TEXT
LOOP LDRB r0, [r1], #1
CMP r0, #0
BNE LOOP
B .
TEXT = "Hello World!", &0a, &0d, 0
END