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 ?
The warning that you don't need a library is just that - a warning.
But another thing. Your assembler file specifies:
AREA HelloW, CODE, READONLY
The linker probably expects to find:
AREA RESET, CODE, READONLY
If you look at the scatter file that you get in your output directory, you'll notice that it wants to place a region RESET first in the LR_IROM1 area, and if there is no RESET, that will be very hard to do.
"HelloWorld.axf: Error: L6218E: Undefined symbol __main (referred from startup.o)"
The default startup.s file is for use with 'C' projects; so it expects you to provide a 'C' program to go with it - which must, of course, have a main() function!
And it will, of course, want to include all the 'C' runtime support libraries.
@Andy: I figured as much too.In fact i tried to replace the START by main (main ADR r1,TEXT) but in vain @Per : You're right;
; ************************************************************* ; *** Scatter-Loading Description File generated by uVision *** ; ************************************************************* LR_IROM1 0x00000000 0x00040000 { ; load region ER_IROM1 0x00000000 { ; load address = execution address *.o (RESET, +First) * (+RO) } RW_IRAM1 0x40000000 0x00004000 { ; RW data * (+RW +ZI) } }
But how do i overcome it ?
Thanks for the input guys, but it would really help if you can
1)direct me to a stepwise procedure as to how to simulate the hello world program (or any assembly program for that matter) in KEIL without actually downloading it on to the target.
2)Tell me if the startup file is needed for simulations too.
Sorry if the queries are basic but i'm a newbie.
No, I do not think that the startup file is needed. But I think you need to modify your assembler file so that it says AREA RESET instead of AREA HelloW.
Or switch to a manual scatter file, where you change the line:
*.o (RESET, +First)
into
*.o (HelloW, +First)
After all, if you run without the startup file, you need to kill the error message:
HelloWorld.sct(7): error: L6236E: No section matches selector - no section to be FIRST/LAST.
And the solution is to make sure that your source do contain a symbol that matches the +First rule in the scatter file.
For simple assembler programs, you don't need a startup file. When creating a new project you will be asked whether to copy the startup file or not.
Regards Marcus http://www.doulos.com/arm/
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.