EmbDev.net

Forum: ARM programming with GCC/GNU tools ARM: Beginners questions about startup and Linker


von sNOOBy (Guest)


Attached files:

Rate this post
useful
not useful
Hello,

I recently started programming an ADuC7026 Microcontroller which has a 
ARM7TDMI core.
I managed to write a code that blinks a LED (attached), however even 
though the code works, there are some issues that I don't understand.

First a question regarding the startup code: At the beginning of the 
startup code I try to set up the vector table whith a Branch to the 
actual startup routine (_start) at the first address, which will later 
be linked to 0x0. However I discovered, that if I modify this line to 
say
reset:  B  reset
the code will still work! Shouldn't this modification result in the MCU 
never reaching the rest of the code?

The second question is about the Linker-script: The Flash begins at 
address 0x80000 which after reset is equivalent with address 0x0? So it 
shouldn't make a difference if the "." variable is set to 0x0 or 0x80000 
before the .text section? What I found was, that this does indeed not 
make a difference. However I can actually give the "." any value I want 
and it will still work! Also exchanging the placement order of the 
subsections to eg:
* (exception_vectors);
* (.text .text.*);
doesn't have any impact!

I feel like any of the described modifications should prove fatal for my 
code.
I would be really glad if someone could explain where I have gone wrong.
Also, as a beginner, I appreciate any other comments and advice on the 
code.

Thanks for your help already!
Greetings

: Moved by Moderator
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.