cancel
Showing results for 
Search instead for 
Did you mean: 

Last entry in vector table provided by ST startup scripts

hazelnusse
Associate III
Posted on September 09, 2011 at 00:16

In all the startup scripts provided by the ST standard peripheral library, there is an entry at the end that is:

  .word  BootRAM     /* @0x1E0. This is for boot in RAM mode for STM32F10x Connectivity line Devices. */

earlier in the startup, BootRAM gets defined like:

.equ  BootRAM, 0xF1E0F85F

The exact address depends on the particular device (low/medium/high/xl density, connectivity, value line, etc.), but all of them have a BootRAM entry in the startup script, and all are the last entry.

I grepped the whole directory tree, and the only place ''BootRAM'' shows up is in the startup scripts.  I can't find any documentation on it at all, and the exception tables in the documentation of each chip don't go as high as this particular exception is located in the vector table, so I'm confused why it is even there.  The memory region is located somewhere in the Cortex-M3's internal peripherals, but I can't find any documentation on it.

Does anybody know what this entry is and what it does?  Does it have anything to do with booting from RAM, like the name suggests?  Maybe something to do with the boot pins?

Thanks,

~Luke
5 REPLIES 5
Posted on September 09, 2011 at 05:58

When you boot from RAM (via the BOOTx pins) the execution address is fixed (processor dependent), and not pulled from the +4 vector address.

As I recall the hex code placed by GCC effectively calls the correct address.

000001E0 F85F F1E0        ldr.w    pc, [pc, #-480]    ; $000004

This behaviour has been discussed on the forum before, but I don't remember seeing any explicit documentation. It suggests the processor is running something else first, but without some hardware trace it's hard to tell what.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hazelnusse
Associate III
Posted on September 09, 2011 at 06:32

The startup scripts in the arm and iar folders of the standard peripheral library don't have an equivalent BootRAM entry in the vector table, they simply have the entries of the vector table that are specified in the data sheet.  Only the TrueSTUDIO and gcc_ride7 startup scripts have this, and since both are based upon gcc, I'm assuming this issue is gcc related.

Can anybody explain *what is going on with this*?  I have read the forum posts on this issue and can see that it needs to be in there, but I have no explanation for it and it doesn't really sit well with me to just put code into my application that I can't explain.

Posted on September 09, 2011 at 06:52

It is specific to code booted in RAM, ie you put it there, and then reboot with appropriate BOOTx settings. It doesn't impact code in ROM or FLASH. People typically don't boot code from RAM in a production environment.

One could easily experiment with this, for example placing one piece of startup code at 0x200001E0, and the one pointed to by the reset vector, and seeing which gets executed.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
hazelnusse
Associate III
Posted on September 09, 2011 at 07:04

I realize that I can experiment with it, but that isn't what I'm after.  I'm trying to understand:

1)  Why isn't it documented anywhere?

2)  Why would this entry in the vector table not exist in the startup scripts for IAR or ARM build systems?

Experimenting with it won't answer these questions.  Perhaps somebody from ST knows the answer?
Posted on September 09, 2011 at 07:31

Don't know, it's one of those undocumented features that exist in many microprocessor systems. It's not mentioned in the errata. The coding addresses a specific behaviour of the STM32F1, lack of support in other tools chains simply means they won't generate working code for the RAM booting scenario. It's a highly atypical usage, the RAM is mainly used in this fashion under JTAG control.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..