AnsweredAssumed Answered

SDCard Bootloader issue

Question asked by longchair.m on Dec 26, 2012
Latest reply on Dec 26, 2012 by longchair.m
Hello,

I am experiencing something strange which I have hard time to inderstand.

I am using a STMF103RBT6 chip with gcc 4.6 / CooCox.

My application would need to update the FW using a .bin file stored on a microsd card. I have read the IAP Notes and such and come up to the following point.

My BootLoader Project is loaded at 0x08000000. it using Chan fatfs lib loads the FW from SD and writes it to 0x08005000. I check the written data and compare it to the data laoded from the bin file after it's been written to the flash.

Then in the bootloader I use the following code to jump to the application code :

#define APPLICATION_ADDRESS 0x08005000
u32 ApplicationAddress = APPLICATION_ADDRESS;

// Now We can Jump to the application
 
NVIC_SetVectorTable(APPLICATION_ADDRESS,0);

// we have one, we need to Jump to bootloader
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{
 /* Jump to bootloader */
 JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
 Jump_To_Application = (pFunction) JumpAddress;
 /* Initialize user application's Stack Pointer */
 __set_MSP(*(__IO uint32_t*) ApplicationAddress);
 Jump_To_Application();
}


What I can observe is the the applciation file starts to be executed. Basically my application will create a Log File and this will be generated, so the booloader seems to have worked properly.

But further in the application initialisation code, I am setting up a DMA double buffer transfer opération and when activating the IRQ the program with

DMA_ITConfig(DMA1_Channel5, DMA_IT_TC | DMA_IT_HT | DMA_IT_TE, ENABLE);

The application will hang.

I don't understand what can make it hang as I have moved the vector table address to the proper area.

the memory mapping defined in the applciation linker file is as follows :

MEMORY
{
 rom (rx)  : ORIGIN = 0x08005000, LENGTH = 0x0001B000
 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00005000
}

_eram = 0x20000000 + 0x00005000;

When i Look at the .map file generated for the application the vector table seems to have been compiled properly :

 

Memory Configuration

Name Origin Length Attributes

rom 0x08005000 0x0001b000 xr

ram 0x20000000 0x00005000 xrw

*default* 0x00000000 0xffffffff

Linker script and memory map

0x20005000 _eram = 0x20005000

.text 0x08005000 0x14fdc

*(.isr_vector .isr_vector.*)

.isr_vector 0x08005000 0x10c ..\obj\startup_stm32f10x_md.o

0x08005000 g_pfnVectors

*(.text .text.* .gnu.linkonce.t.*)

.text.RTC_GetCounter

0x0800510c 0x38 ..\obj\stm32f10x_rtc.o

0x0800510c RTC_GetCounter

 

 

Any suggestion is welcome.


Outcomes