EmbeddedRelated.com
Forums

Secondary bootloader - code won't execute

Started by ajellisuk March 3, 2009
Hi,

I put this issue to one side for a couple of weeks for various reasons hence the delay in replying.

I have remapped the interrupt vectors to RAM by setting MEMMAP = 2. However my code now crashes as I step throught the main() function in my code.

Does anyone have any ideas as to what is causing this please?

Thanks

Andrew

An Engineer's Guide to the LPC2100 Series

Hello,
I think my problem is very close to this thread, but reading it and extra docs I have already some doubts, I hope you could solve me.

I have MyBootloader which is at 0x80000000 and MyApplication which is at 0x80010000. When I reach the main() of MyApplication SOMETIMES it is restarted and goes back to MyBootloader, and OTHER TIMES, an exeption occurs.

I am newbie in this, so I have not very clear if my problem could be related to VIC remap. I am using a LPC2220 and Keil. I nees some clues to solve my problem.

* I have modified in the target of MyApplication the start address to 0x40000040 to let space to interruption vector.

* I am not sure where in the startup.s of MyApplication I have to make any modification to remap in RAM or if I have to change in the Options>ASM something different to EXTERNAL_MODE.

Do I have to deal with other issues related to user mode, supervisor mode...? I am completely newbie in this.

Thanks in advance,

grosella

I have answered my question. Here is the description of what I was looking for.

It was necessary to map interruption vectors of the Application program (which is at 0x80010000) to RAM memory.

The solution to my question is at AN10835 (LPC secondary bootloader for code update using IAP). In that document, among other subjects, it is detailed how to map interruption vectors to RAM memory.

Basically, it is necessary to store the interruption vectors in RAM,

IF :DEF:VECINT_RAM
ADR R8, Vectors
LDR R9, =RAM_BASE
LDMIA R8!, {R0-R7}
STMIA R9!, {R0-R7}
LDMIA R8!, {R0-R7}
STMIA R9!, {R0-R7}
ENDIF

And to set MEMMAP to 2 in the Startup.s

LDR R0, =MEMMAP
IF:DEF:VECINT_RAM
MOV R1, #2
ELSE
MOV R1, #1
ENDIF
STR R1, [R0]

Where RAM_BASE is defined as RAM_BASE EQU 0x40000000

And VECINT_RAM is defined (using keil) at Project > Options for Target xxx>ASM>Define

In the Project>Options for Target it is interesting to reserve space for interruption vectors in RAM. The IRAM start address should be 0x40000040 to keep the first 64 bytes for the interruption vectors.

Grosella