EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

an10711 USB Bootloader

Started by eremitic193 September 14, 2008
Hello,

I am trying to get an10711 bootloader working on MCB2140 for my
application. I am linking my application at 0x00002000 and my
bootloader is at 0x00000000-0x00002000. My application downloads
correctly and starts to run in my main function but stops when it hits
os_sys_init function for RTX. At which point it goes to assembly
sitting on:

0x00000040 EAFFFFFE B 0x00000040
Does anyone have any suggestions as to what may be happening?
Or what I may have forgotten to do?

I will continue my research and if I find anything else I will post it.

-Zach

An Engineer's Guide to the LPC2100 Series

It has been a while since I looked at this App note, so my comments are
generalizations based on having done other boot loaders.

What I think is going on:

There are three map formats in the LPC - Boot, normal flash and
RamVectors.

When the chip comes out of reset, the serial boot loader gets firmware
control, running at address zero in its map. It looks at the ISP pin
and the serial port to decide if it should go into ISP mode or just load
the FLASH application.

Assuming that it moves to flash, it remaps the flash so your program is
remapped to address zero. This is kind of a pre-programmed Memory
Management Unit. (A similar system remaps the interrupt vectors from
flash to RAM.)

The app note USB Loader is really just an application living at this
user flash address zero. Think of it as THE app. It starts and runs and
does a job. In this case, its job is to do about what the built in
serial loader does - decide if a host wants to download a new
application via USB or if it should branch to your previously downloaded
application.

OK.. With all that, you say that your application starts, then ends up
at address 40. If you look at the typical startup code, the vectors -
which are limited to one instruction - are usually short-jumps to the
real code. Reset normally jumps to 0x40 which then long jumps to the
real entry point.

I am wondering if you need to change your application startup code to be
org'ed at 0x2000. I also question how the App Note handles other
interrupts - like IRQ and FIQ. Take a look at that. The normal system
is for the loader to have a jump handler that jumps indirect through a
RAM location. It has to do this since it can't change the MMU function
to org your real application at 0x00.

If you are not comfortable with ARM assembly, this is a great time to
learn the basics. Just step through the debugger. You should be able to
quickly catch on to the assembly language.

I hope this helps.

Dan

From: l... [mailto:l...] On Behalf
Of eremitic193
Sent: Sunday, September 14, 2008 1:37 AM
To: l...
Subject: [lpc2000] an10711 USB Bootloader

Hello,

I am trying to get an10711 bootloader working on MCB2140 for my
application. I am linking my application at 0x00002000 and my
bootloader is at 0x00000000-0x00002000. My application downloads
correctly and starts to run in my main function but stops when it hits
os_sys_init function for RTX. At which point it goes to assembly
sitting on:

0x00000040 EAFFFFFE B 0x00000040

Does anyone have any suggestions as to what may be happening?
Or what I may have forgotten to do?

I will continue my research and if I find anything else I will post it.

-Zach


Solution:

Remap Vectors to ram. Then run from ram mode. (MEMMAP = 2)

In Keil uVision 3

1.) Set to run from ram.
Options -> Asm -> Conditional Assembly Control Symbols

Define: RAM_INTVEC REMAP RAM_MODE

2.) Modify startup.s to copy vectors to ram.

3.) Modify scatter file to allow room for vectors in ram.
(Also double checking that your app is being placed at the correct
location in ROM. IE: Mine was 0x00002000 - 0x0007E000

Application so far appears to be loading and running just fine
via the bootloader. If I find any problems I shall post again.

Thanks for the tips Dan.
-Zach


The 2024 Embedded Online Conference