This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM and interrupts




How about the stack pointer etc.? Do I have to set up that specifically for IRQ mode, too? Is the morale perhaps that I simply can't use the crt0 provided with newlib? (I was otherwise thinking that I might simply insert the vectors in front of it, if you now what I mean.)



It depends. Angel, when present, sets up the stack pointers for all operational modes. If you turn of RDP/RDI, you expose a bug whereby the stack pointer gets initialized to a value that causes it to gobble up your program!

Really? Lucky for me that I changed that code already, then ;-)


My build setup will patch crt0.S so that it sets the initial stack pointer to the address of symbol __stack, typically defined via the linker script, instead of using a hardcoded value. This logic is taken from the MC68k setup.


You're mostly correct: for embedded work you'll need to roll your own _start function. Use the crt0 that comes with newlib as a guide, but note that it doesn't do anything involving the various stack pointers for the "other" modes. See gdbstubs for that if you need examples.

I'm now writing a crt0 that's basically a combination of the one supplied with newlib and the init code from the code examples mentioned earlier. I've also looked a bit at the gdbstubs sources, but I haven't been able to find the relevant code yet. Maybe I don't have all the files, or the wrong version? - I got it like this:


cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/gdbstubs co gdbstubs


See also the ARM Architecture Reference Manual, by David Seal. It contains some brief examples too.



I'll have a closer look at what you mention here...



The book is good, but it isn't cheap. But hey, lack of knowledge on these details is even more expensive!

Good point. I'll seriously consider buying a real book. I've relied on the downloadable docs so far...



We also found some example code for a test board from Motorola (we're actually using a Motorola CPU with ARM core), and it turns out that they also have an "Interrupt Controler" application note that's quite helpful (unlike the CPU reference manual, I might add..)



Yes, I was going to mention something related to that. With the "advanced/vectored interrupt controllers" that are all the rage now, there are some nifty tricks you can use to really boost interrupt handling performance. I have examples, but if there are some in your manuals then go with them.



b.g.




------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]