ARM: Beginners questions about startup and Linker

Guest #2948720
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
Attached files:

Reply

A question of your own? This thread is over 13 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.