cancel
Showing results for 
Search instead for 
Did you mean: 

How to read CSx config bit (boot bank selection bit)?

mark9
Associate II
Posted on May 02, 2007 at 07:21

How to read CSx config bit (boot bank selection bit)?

1 REPLY 1
mark9
Associate II
Posted on May 17, 2011 at 09:42

I understand that the JTAG is the only way to set the CSx bit, which configures which bank (BANK0 or BANK1) is the boot bank and which is the non-boot bank, but I was wondering if there is a way to read the state of the bit from software? In the ST library FMI code, you have to hard code the state of this bit, so that your code can *ONLY* run if you know the state of this bit ahead of time. This is really annoying. I would like to fix the code so that I can access BANK1 (which is the FMI, and necessary to read the OTP block where my MAC address is) without knowing which bank was the boot bank, since that is irrelevant.

Most of the STR9 architecture seems pretty well thought out, but this is a glaring deficiency, that you do not have a way of directly accessing the OTP without going through the ''flash memory map'', and there is no way of figuring out what the flash memory map is at all at run time!

For example, this would be useful for in-circuit jtag debugging with IAR which doesn't support BANK1, so you need to boot from BANK0, but later (in production) you will want to boot from your bootloader in BANK1. I don't want to have to maintain two binary images for the two possibilities.