This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Changing Application Start Address in boot_emac_flash



I'm trying to change the APP_START_ADDRESS in the boot_emac_flash example and it's not working.  When the APP_START_ADDRESS is 0x4000, then it works fine. 

Here's what I'm doing, I'm using the DK-TM4C129X.  I program the boot_emac_flash example and then I program the freertos_demo.  I've set the flash settings so that when I program the freertos_demo, it doesn't erase the bootloader area.  When I reset the device, the bootloader correctly jumps to the application and the application runs properly.  Also note that I did change the APP_BASE of the freertos_demo to start at 0x4000.  However, if I change the settings in the bl_config.h to indicate that the application starts at 0x8000 instead of 0x4000 and I change the freertos_demo to start at 0x8000, the bootloader doesn't jump to the application.  Is there something else that I need to change in order for the bootloader to jump to the application at a different address than 0x4000 since 0x4000 was the default in the bootloader.

Thanks.

  • Hello SL,

    Did you change the VTABLE_START_ADDRESS as well?

    Regards
    Amit
  • Hi Amit,

    I did change the VTABLE_START_ADDRESS. I actually defined VTABLE_START_ADDRESS to be the APP_START_ADDRESS:

    #define VTABLE_START_ADDRESS APP_START_ADDRESS

    However, I did noticed that the NVIC_VTABLE still shows 0x4000 when I break the application. So this is the cause of it but I'm not sure why the NVIC_VTABLE isn't changing to something besides 0x4000. I'm going to inspect the assembly code where it sets the NVIC_VTABLE but I would have thought that this would be correct since I'm using the example.

    Thanks.
  • Hello SL,

    Where is the NVIC_VTABLE in the bl_config.h?

    Did you update the cmd file in the application code to start from 0x8000 instead of 0x4000?

    Regards
    Amit
  • Hi Amit,

    The NVIC_VTABLE isn't in the bl_config.h. What I meant is that when I pause the bootloader, I check the NVIC_VTABLE value in the Registers window and see that it's still 0x4000 instead of 0x8000 even though I've changed the VTABLE_START_ADDRESS to be 0x8000. The issue I see is in the assembly code below. What it is, I just can't pinpoint right now. I believe it has something to do with the NVIC_VTABLE as I'm not sure where it's getting the value of NVIC_VTABLE since I can't find that defined anywhere. I would have thought that it would be using VTABLE_START_ADDRESS instead of the NVIC_VTABLE.

    ;;
    ;; Set the application's vector table start address. Typically this is the
    ;; application start address but in some cases an application may relocate
    ;; this so we can't assume that these two addresses are equal.
    ;;
    movw r0, #(VTABLE_START_ADDRESS & 0xffff)
    .if (VTABLE_START_ADDRESS > 0xffff)
    movt r0, #(VTABLE_START_ADDRESS >> 16)
    .endif
    movw r1, #(NVIC_VTABLE & 0xffff)
    movt r1, #(NVIC_VTABLE >> 16)
    str r0, [r1]

    Thanks.
  • Hello SL

    Can you please try

    #define VTABLE_START_ADDRESS 0x8000

    instead of

    #define VTABLE_START_ADDRESS APP_START_ADDRESS

    Regards
    Amit
  • Hi Amit,

    I just tried it and it still doesn't change the NVIC_VTABLE value.

    Thanks.
  • Hello SL,

    NVIC_VTABLE is defined as 0xE000ED08 and is the NVIC Address Space to load a non-zero vector table address. This Register is loaded with the Vector Table location of 0x8000 and that is what

    str r0, [r1]

    is doing.

    Did you clean the project, rebuild it. Also can you please check if the cmd file of the application code has been modified?

    Regards
    Amit
  • Hi Amit,

    I did figure out what the assembly code was doing and it made sense. I figured out the problem, I have to rebuild the bootloader project when I change the starting address, just a build doesn't work, not sure why. But if I change the start address and do a rebuild then it works just fine. Thanks for all your help.
  • Hello SL

    Great work. Sometimes a full rebuild helps (I keep that as my first bullet in checklist of a failing code)

    Regards
    Amit