EmbDev.net

Forum: ARM programming with GCC/GNU tools Program start offset in hex code? ISR definition required?


Author: Randall Aiken (Guest)
Posted on:

Rate this post
0 useful
not useful
A couple of questions regarding porting some Keil code over to WinARM:

(1) How do I program in an offset of 0x2000 to the code start in the hex
file?  In other words, I want the hex file to have zeros in the first
0x2000 locations (0x0000 to 0x1FFF), and the code base to start at
location 0x2000.  This is to allow space for my resident bootloader
program which transfers execution to the main app at location 0x2000.
In the Keil compiler I am able to do this by putting the following in
the "user classes" section of the LA locate tab:

DATA (0x40001FFF-0x40003FFF), CODE (0x2000-0x1FFFF), CONST
(0x2000-0x1FFFF)

(2) How do I specify a function to be an interrupt service routine?  In
the Keil compiler, I have to do it with an __irq statement like this:

void keypad_irq(void) __irq

and then I assign it in the interrupt initialization routine like this:

VICVectAddr1 = (unsigned long) keypad_irq;
VICVectCntl1 = 0x00000030;

Is there a corresponding directive like the "__irq" in WinARM to
identify a routine as being an IRQ, or is that not necessary?  I noticed
in the example UART ISR routines there was nothing to label the routine
as an interrupt service routine, but I didn't know if there was any
other code elsewhere that might be necessary.

Thanks,

Randall Aiken

Author: Randall Aiken (Guest)
Posted on:

Rate this post
0 useful
not useful
I think I figured out the answer to question (1).  I changed the LPC2129
linker script file from

MEMORY
{
  ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x0003E000
  RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000
}

to:

MEMORY
{
  ROM (rx) : ORIGIN = 0x00002000, LENGTH = 0x0003C000
  RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000
}

This appears to do the trick.   However, it brings up a question:  Why
is the original LENGTH = 0x003E000?  Doesn't the Philips LPC2129 flash
memory start at 0x0000 and go to 0x0003FFFF?   Shouldn't the LENGTH be
0x00040000?  Or is this to leave room for something else?

Thanks,

Randall Aiken

Author: Mh Tay (lpc2103)
Posted on:

Rate this post
0 useful
not useful
Last 8KB flash taken up by philips for bootloader.
I think it is bigger of 12Kb on LPC213x/4x.

ISP Taken up 16-128 bytes of SRAM at high address.
I'm not sure if IAP use up fixed location SRAM space
or calling program's stack space.  Documentation is
a bit messy.   So, may be you should leave some space
on SRAM if you call IAP.

The Flash/SRAM space reserved by philips is documented
on lpc213x/4x user manual.

Also, may be you have to make sure GCC places your
startup code at 0x2000.  Else, you gotto do a bit of
assembly hard coding for proper startup at 0x2000.

You own loader need to route FIQ to some fixed location.

Regards

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.