Skip to main content
eancelin
Associate II
June 26, 2012
Question

Modify the start address 0x800 0000

  • June 26, 2012
  • 28 replies
  • 10464 views
Posted on June 26, 2012 at 16:26

Hi,

My microcontroller is a STM32F103CB.

I followed the AN2557 to do an IAP in my software. Everything works fine but now I would like to do something like a dual bank features.

I can flash two firmwares at two different address in flash (for example, one @0x8003000 and the second @0x8006000) but when my IAP software starts (@0x800 0000), if I do the classical test ( if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000) ) the first bank will be still OK, so I never start the firmware in the second flash.

Is there a way to set an option to know which ''bank'' is activated?

Is there a way to modify by software the start address (modify the 0x800 0000 address)?

I hope my request is enought clear!!

Regards,

#flash #groundhog-day #start-address #iap #stm32
This topic has been closed for replies.

28 replies

Tesla DeLorean
Guru
July 19, 2012
Posted on July 19, 2012 at 13:09

Why need ''

+4

'' ? Review the vector table content. +0 Initial Stack Pointer +4 Initial Program Counter

g_pfnVectors:
.word _estack
.word Reset_Handler
.word NMI_Handler
.word HardFault_Handler
.word MemManage_Handler
.word BusFault_Handler
.word UsageFault_Handler

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
duongcam1312
Visitor II
August 20, 2012
Posted on August 20, 2012 at 04:35

Hi clive1 ! 

How to detection program hang? I want watchdog or reset system,if program hang.but i don't known Flag or regedit to detection them

Thank you verry much

.

Tesla DeLorean
Guru
August 20, 2012
Posted on August 20, 2012 at 18:22

Depends on how/where it locks-up.

If you have an RTOS, you could kick the watchdog it the lowest priority task, if that never gets executed in these conditions.

Is code getting stuck in a Hard Fault handler?

Do you have code with unbounded while() loops? Could you add timeouts to these and handle the error propagation better?

Do you get stuck in interrupt context?

Other methods use two layers, a software layer that has multiple check points, say each task masking a completion bit, once all tasks indicate completion the hardware watchdog is kicked.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
duongcam1312
Visitor II
August 21, 2012
Posted on August 21, 2012 at 03:31

Thank for your help !

I don't have RTOS. I working IAP, and I want progrram Bootloader check to detection program application hang or don't working.

Arnhold.Rodrigo
Visitor II
February 9, 2015
Posted on February 09, 2015 at 17:29

Hello haui.bien! Recently I came across a similar problem what you reported on the forum. I'm using a STM32F103RB with bootloader + application. I configured NVIC_VectTab_FLASH , 0x08000000 to the bootloader and NVIC_VectTab_FLASH , 0x08003000 for the application. But it only works if the application is set to NVIC_VectTab_FLASH , 0x08000000 . I use keil 5 environment. In ''options for target/Target/Read/Only Memory Areas'' the start address '' IROM1 '' is set to 0x8003000 and size 0x1D000 . What am I doing wrong?

I am new in this MCU. Thanks

Tesla DeLorean
Guru
February 9, 2015
Posted on February 09, 2015 at 17:55

What am I doing wrong?

 

Real hard to determine from the data. You'd need to confirm the firmware is built for the correct location by reviewing the .MAP file. You'd also want to confirm the address programmed into the SCB->VTOR register during SystemInit() does actually point to your application code.

You also need to confirm your boot code is built correctly, and that it transfers control properly to the application, and doesn't have any interrupts enabled which might break if unhandled by an uninitialized application.

Use a debugger.

Step through your transition code, review where the current code breaks or hangs up. Check that core registers a set up at the addresses you expect them to be.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Arnhold.Rodrigo
Visitor II
February 11, 2015
Posted on February 11, 2015 at 01:31

Hi Clive1 . The code which I am working was done by someone else with I no more have contact. I worked with other codes that were built with 0x08000000 starting address as in this code. When added the bootloader to these other codes , the only changes I made was to change the starting address 0x08003000 in keil ''target options/target/ROM1'' and change NVIC_SetVectorTable ( NVIC_VectTab_FLASH , 0x3000 ) ; However this code when I change these parameters does not work. When I debug the code these errors occur .

Can not access Memory

*** Error 122: AGDI : memory read failed ( 0xFFFFFFFE )

Can not access Memory

Can not access Memory

Can not access Memory

Can not access Memory

Can not access Memory

I'm not relating the problem to the bootloader , because I'm trying to work only writing the application in flash with initial address 0x0800300 , as well as in other code that I worked , which work with both start addresses .

hpb
Visitor II
April 8, 2015
Posted on April 08, 2015 at 14:18

Hi there,

did somebody find the reason?

I've the same problem. An application, which works fine at start-address 0x0800 0000 doesn't work at 0x0802 0000. Some code works at this start-address, also interrupts etc. are working fine. But if the LCD is integrated to the code, the software stops working - don't know why.

At address 0x0800 0000 I have (at the moment) only a redirection to the vector-table at 0x0802 0000 and jump it (+4+1).

... it's really crazy and would be fine, if somebody would have an idea ...

Best regards,

Hans-Peter

---

By the way: It's necessary to jump to (APPLICATION_ADDRESS +4 +1).

hpb
Visitor II
April 8, 2015
Posted on April 08, 2015 at 14:28

I've find something out at my board (STM32F429i-DISCOVERY). If the display it operated in LTDC-Mode, it fails.

My problem: LTDC-Mode is used at my custom-bootloader.

Has somebody an idea how to reset the STM32F429 by reset - but to avoid that it will jump back to bootloader?

... thank's ...

Tesla DeLorean
Guru
April 8, 2015
Posted on April 08, 2015 at 15:56

Ok, the second entry in the vector table, at +4, contains the address of the Reset_Handler code which the processor jumps too.

You would only need to +1 the address of a symbol if the address were even, as supplied by the .MAP or whatever, to designate that the code is in the THUMB (16-bit) instruction set, because the Cortex-Mx parts can't execute ARM (32-bit) instructions, where the PC is even.

The part, as explained earlier, can only start execution at reset from specific addresses. You can jump to whatever code you want to after it starts, and you can change the Vector Table address.

If your Boot Loader leaves IRQ or DMA actions active when it hands control to the application code, you'd better be prepared to deal with that, otherwise things will break. The best course of action is to tear down whatever the Boot Loader set up before handing over control, or passing enough information to the application so it can take over that role.

When you change the base of the code, you also need to adjust the Vector Table address (SCB->VTOR) typically in SystemInit() to reflect the new base address. The base address should fall on a 512-byte boundary.

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