We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to simulate the below ARM assembly program on uvision3.
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).
How do i go about rectifiying this? Should i include the startup file eventhough i only want to simulate the code on KEIL ?
So-called "startup" files are there for the benefit of 'C' programs - because the 'C' compiler's runtime has specific requirements that must be set up in order for it to work - and the "startup" files do that.
The "startup" files are effectively part of the 'C' runtime support.
It would be more accurate and (possibly) helpful if they were referred to as "the 'C' startup files"
When you write in assembler, you assume all responsibility for whatever initialisations the rest of your program may require - so you don't include the 'C' startup files (unless you've carefully studied them and found that they happen to do just what you require).
"For simple assembler programs, you don't need a startup file."
To be more precise: for assembler programs, you need to do all the necessary initialisations within your program.