Skip to main content
karan
Associate III
August 3, 2015
Question

stm32f030cc how to move application to different location

  • August 3, 2015
  • 6 replies
  • 1706 views
Posted on August 03, 2015 at 16:25

i am using stm32cube and arm mdk 5 for my code development for stm32f030cc. i developed one free rtos based application which is running fine.i want to develop boot loader to download my rtos based application for remote update using usart.i can not use built in boot loader. so i decide my own bootloader application without free rtos.

i planned that first my boot loader application and then my user application resides in flash.

to move my rtos based application to different memory location other than 0x08000000

i update start address and length field in (option->target field).but when i download code its not working.

so is there is any example or document which help to full fill my need??
    This topic has been closed for replies.

    6 replies

    Tesla DeLorean
    Guru
    August 3, 2015
    Posted on August 03, 2015 at 18:39

    There are IAP examples, and the topic of relocating the Cortex-M0 vector table has been addressed here several times before.

    You will need your boot loader to transfer control. Changing the base of the application and loading it directly isn't going to permit it to execute. You will also need to add code to the application to copy your new vector table into RAM, and then map the RAM at address zero. Ideally you'll bump up the base of RAM in order to carve a space for the vector table that other code will not use.

    See the code at the END of [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/Cortex%20M0%20Vector%20relocation%20issue&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=1242]this thread.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    karan
    karanAuthor
    Associate III
    August 4, 2015
    Posted on August 04, 2015 at 09:41 first i can not build example iap project.is there any project for stm32f0xx.and in project jump to application function is not acessable. and if i want to move my application to different location where should i write these lines????

    uint32_t *VectorTable = (uint32_t *)0x20000000; // Carve space here via linker script, or attributes
    // Copy the vector table from the Flash (mapped at the base of the application
    // load address 0x08003000) to the base address of the SRAM at 0x20000000.
    for(i = 0; i < 48; i++) // Check Vector count on your part
    VectorTable[i] = *(__IO uint32_t*)(0x08003000 + (i<<2));
    // Enable the SYSCFG peripheral clock
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
    // Remap SRAM at 0x00000000
    SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);
    
    

    means in which files??
    karan
    karanAuthor
    Associate III
    August 4, 2015
    Posted on August 04, 2015 at 12:56

    i had one free rtos based application working. i made following changes. in target dilog box

    IROM1=0x08003000 len 0x3D000 IRAM1=0x200000c0 len0x7F40

    and in main.c

    uint32_t *VectorTable = (uint32_t *)0x20000000;

    HAL_Init();

    /* Configure the system clock */

    SystemClock_Config();

    for(i = 0; i < 48; i++)

    VectorTable[i] = *(__IO uint32_t*)(0x08003000 + (i<<2));

    // Enable the SYSCFG peripheral clock

    RCC->APB2ENR |=0x00000001;

    // Remap SRAM at 0x00000000

    SYSCFG->CFGR1|=0x00000003;

    but when download code through debugger not working.

    here i attach map file

    ________________

    Attachments :

    final_getway_Configuration.map : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0p2&d=%2Fa%2F0X0000000bfJ%2FQY_yFDm5_tAsFmvnvvVdqITElirFnuicldi_hW6sDhU&asPdf=false
    Tesla DeLorean
    Guru
    August 4, 2015
    Posted on August 04, 2015 at 15:16

    0x08003000 is the application basis in the example. This is the ''source'' of the vectors as this is where the linker forms them.

    I think HAL_Init() enables a ticker interrupt, so it would be *important* to have a working vector for the application prior to calling that.

    You could review the IAP example(s), and failing all that, use the debugger and step through and look at what's going on with the processor and the memory.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    karan
    karanAuthor
    Associate III
    August 18, 2015
    Posted on August 18, 2015 at 17:24

    than you i put it before init function and now i am able to jump on application but some of my task or bay be some of uart is not working when  only application running(with out shifting and mapping (original)).so what should be problem??in my application i think usart6 & 1 or its related task not working and uart3 and its related task working fine.can you help me please.... 

    Tesla DeLorean
    Guru
    August 18, 2015
    Posted on August 18, 2015 at 18:18

    USART1 and USART6 are on APB2, make sure you've enabled the right clocks.

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