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.

LP-MSPM0G3507: LP-MSPM0G3507

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: MSPM0G3507, MSPM0-SDK

Tool/software:

Hello, 

I am working with custom  bootloader of MSPM0G3507. This bootloader implemented using UART and doing crc nd version check before writing new hex to flash.

In my bootloader application upon reset bootloader runs first then checks for the application at desired location presented or not if present then jump to that app if not then runs normal bootloader code.

At last if full crc of received code and calculated local crc match then it will make a jump to new application which is flashed but the issue was when i make a jump through my jump function,interrupts of jumped application not worked, it will reset the uc and start from the bootloader app at 0. as i mentioned it will check and jump to the app again.

so the main error is my interrupt handler never get executed and never wrtie bootcmd(1 at flash loc 0x0001F058 ). it wil repeat every time when interrupt i give gpio interrupt.

so can anybody help me with this beacause i am not able to find this issue and this was my first bootloader code. i attach the jump function and irq handler also linker file.

  

Linker Command File

#include "ti_msp_dl_config.h"
#include "string.h"
#include "stdio.h"
#include "core_cm0plus.h"

#define BOOTLOADER_VECTOR_TABLE_ADDRESS  0x00000000
#define BOOTLOADER_INT_LOCATION          0x0001F058 /* At this location flag set by applicant who wish to turn on boot mode to flesh nex hex */
#define VTOR_OFFSET                      (uint32_t *)0x00003E80
#define NO_ERROR                    0
#define ERROR_WRITE_32_BIT          6

void jump_to_app(uint32_t);
uint8_t BootCmdWrite(uint32_t);

volatile uint8_t gErrorType = NO_ERROR;
volatile DL_FLASHCTL_COMMAND_STATUS gCmdStatus;
uint32_t gCmd32 = 0x00000001;
uint32_t gCmdTemp;

int main(void) {

    //early_irq_enable();

    SYSCFG_DL_init();
    SCB->VTOR = (uint32_t)VTOR_OFFSET;
    __enable_irq();
    NVIC_ClearPendingIRQ(USR_BOOT_INT_IRQN);
    NVIC_EnableIRQ(USR_BOOT_INT_IRQN);

    while (1) {
        DL_GPIO_togglePins(USER_LED_PORT, USER_LED_RED_LED_PIN);
        delay_cycles(16000000);
    }
}
void GROUP1_IRQHandler(void)
{
    switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1)) {
        case USR_BOOT_INT_IIDX:
            /* If SW is high, turn the LED off */
            if (DL_GPIO_readPins(USR_BOOT_PORT, USR_BOOT_BT_PIN_PIN)) {
                BootCmdWrite(gCmd32);
                DL_GPIO_togglePins(RGB_PORT, RGB_GREEN_LED_PIN);
                delay_cycles(64000000);
                jump_to_app(BOOTLOADER_VECTOR_TABLE_ADDRESS);
//              NVIC_SystemReset();
            }
            break;
        default :
            break;
    }
}

uint8_t BootCmdWrite(uint32_t cmd) {
    if (gErrorType == NO_ERROR) {

        DL_FlashCTL_unprotectSector(FLASHCTL, BOOTLOADER_INT_LOCATION, DL_FLASHCTL_REGION_SELECT_MAIN);
//        gCmdStatus = DL_FlashCTL_programMemoryFromRAM64WithECCGenerated(
//                                   FLASHCTL, BOOTLOADER_INT_LOCATION, &cmd32[0]);
        DL_FlashCTL_programMemoryFromRAM32WithECCGenerated(
                                        FLASHCTL, BOOTLOADER_INT_LOCATION, &cmd);
        // Ensure write is fully committed
        __DSB();  // Data Synchronization Barrier
        __ISB();  // Instruction Synchronization Barrier
        if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED)
        {
            /* If command was not successful, set error flag */
            gErrorType = ERROR_WRITE_32_BIT;
        }
        DL_FlashCTL_protectSector(FLASHCTL, BOOTLOADER_INT_LOCATION, DL_FLASHCTL_REGION_SELECT_MAIN);
        gCmdTemp  = *(uint32_t *)BOOTLOADER_INT_LOCATION;

    }
    return gErrorType;
}

void HardFault_Handler(void)
{
    // Debug indicator - blink LED or breakpoint
    while (1)
    {
        DL_GPIO_togglePins(RGB_PORT, RGB_GREEN_LED_PIN);
        for (volatile int i = 0; i < 100000; i++); // Simple delay
    }
}

void jump_to_app(uint32_t app_addr) {

   __disable_irq();
   // Disable and clear all interrupts
    for (uint32_t i = 0; i < 8; i++) {
        NVIC->ICER[i] = 0xFFFFFFFF;  // Disable IRQs
        NVIC->ICPR[i] = 0xFFFFFFFF;  // Clear pending IRQs
    }
       __DSB();
       __ISB();

    // Reset SysTick just in case
    SysTick->CTRL = 0;
    SysTick->LOAD = 0;
    SysTick->VAL = 0;

    uint32_t sp = *((uint32_t *)app_addr);         // Stack pointer
    uint32_t reset = *((uint32_t *)(app_addr + 4)); // Reset handler

    __set_MSP(sp);
    SCB->VTOR = app_addr;  // If needed


    ((void (*)(void))reset)(); // Jump to reset handler
}

  • This linker file should be the app's linker file, because you are using Flash start address from 0x3E80.

    In your code, I think this is the bootloader code, bootloader should start from 0x0, and app start from 0x3E80.

    If you are using different code structure, please tell me.

    Tips:

    You need to set SCB->VTOR before you jump to app/boot, not right after the SYSCFG_DL_init.

    Is your GROUP1_IRQHandler start from 0x3E80?

    And you are using jump to app to jump to boot?

    You can not jump in a IRQ handler, please set a flag in IRQHandler, then jump_to_app in main while.

  • Yes you are right this is app code and as you see i set vtor and all in the jump function(setting vtor right after init is for testing). as you suggest me to set a flag in gpio handler but why i cant jump from the isr? and if i set the flag in the isr then jump from the main as you suggesetd but the problem is my gpio isr not executed full at all every time i give gpio interrupt it will reset the uc.

    Technically i do jump to app to bootloader but my goal is to when i need to flesh the new hex via bootloader i need to give interrupt(app interrupt which is runnig after reset) and it will run the bootloader code so i can flesh the new hex file, checks are there in bootloader code.

    00003f41 GROUP1_IRQHandler address in app, 00003e80  interruptVectors 

  • why i cant jump from the isr?

    Now it's in handler mode, but when a code start from running, it should be in a thread mode.

    Please try to find some information of ARM handler mode and thread mode difference and limitation.

    and if i set the flag in the isr then jump from the main as you suggesetd but the problem is my gpio isr not executed full at all every time i give gpio interrupt it will reset the uc.

    Since int vector is shift from xxx to 0x3E80, you need to make sure that GROUP1_IRQHandler is in 0x3E80's int vector.

    By then way, what's the data in Flash at 0x0? Since both your boot and app not start from 0x0.

    It's also weird that 00003f41 - 00003e80  = 193 in Dec and 193/4 is 48 > 32.

    A valid int vector length is 0xC0, and usually start from 0x0 end of 0xBF, which length is 192 in DEC.

  • My custom bootloader code at 0x0 and at 3E80 my app code.

    this means first run bootloader code but in the bt code after init i checked for app code is present or not if there then jump ,not then runs bt code and wait for the heartbeat from external world. so the purpose of putting gpio interrupt in app code is to jump back to the bootloader code for new. 

  • I tried as you said by setting flag in the isr then process the jump in main and setting vtor right just before reset handler call in jump funnction but not worked same as before. I see the code where they set PSP(Process Stack Pointer) so need set psp or not?

  • It's also weird that 00003f41 - 00003e80  = 193 in Dec and 193/4 is 48 > 32.

    A valid int vector length is 0xC0, and usually start from 0x0 end of 0xBF, which length is 192 in DEC.

    Please check the interrupt vector and compare it with a normal example code imported from MSPM0 SDK.

    Group1 and int vector address difference is too large.

    int main(void) {
    
        //early_irq_enable();
    
        SYSCFG_DL_init();
        SCB->VTOR = (uint32_t)VTOR_OFFSET;
        __enable_irq();

    There is no need to set SCB->VTOR in main, this should be set in jump_to_app function, both in app and boot.

    I see the code where they set PSP(Process Stack Pointer) so need set psp or not?

    It's OK to reset the SP before jump to other image.

    Here is the code example that you can refer, to jump to other image:

    C:\ti\mspm0_sdk_2_04_00_06\examples\nortos\LP_MSPM0G3507\boot_manager\boot_application

    static void start_app(uint32_t *vector_table)
    {
        /* The following code resets the SP to the value specified in the
         * provided vector table, and then the Reset Handler is invoked.
         *
         * Per ARM Cortex specification:
         *
         *           ARM Cortex VTOR
         *
         *
         *   Offset             Vector
         *
         * 0x00000000  ++++++++++++++++++++++++++
         *             |    Initial SP value    |
         * 0x00000004  ++++++++++++++++++++++++++
         *             |         Reset          |
         * 0x00000008  ++++++++++++++++++++++++++
         *             |          NMI           |
         *             ++++++++++++++++++++++++++
         *             |           .            |
         *             |           .            |
         *             |           .            |
         *
         * */
    
        /* Reset the SP with the value stored at vector_table[0] */
        __asm volatile(
            "LDR R3,[%[vectab],#0x0] \n"
            "MOV SP, R3       \n" ::[vectab] "r"(vector_table));
    
        /* Set the Reset Vector to the new vector table (Will be reset to 0x000) */
        SCB->VTOR = (uint32_t) vector_table;
    
        /* Jump to the Reset Handler address at vector_table[1] */
    
        ((void (*)(void))(*(vector_table + 1)))();
    }

  • Also, I won't recommend you to put a Flash operation in IRQHandler too.

  • i will check the details you mentioned and let you know, also i have one question can i checks vector through .map file? it is right ? or from somewhere  else? this address i mention is from .map file

  • so how can i do by setting flags respective to responses and do process in the main ?

  • somewhere  else? this address i mention is from .map file

    From .map file is OK. Please delete all debug files and then rebuild, make sure .map is latest.

    so how can i do by setting flags respective to responses and do process in the main ?

    Yes. GPIO Handler set flag, then run all other task in main while.

    It's also weird that 00003f41 - 00003e80  = 193 in Dec and 193/4 is 48 > 32.

    A valid int vector length is 0xC0, and usually start from 0x0 end of 0xBF, which length is 192 in DEC.

    This address is still weird, please check them.

  • i checked the map file of imported project of gpio interrupt of same but there no bootloader so the start addr is 0 and vector table lenght is C0 and for app it  starts from 3e80 and length same C0 in map file. rebuilding after deleting all the file 4271 for group1 handler and for imported project gpio simultaneous interrupt 14d or group1 so you said  difference is large.  

  • Can i use boot application start_app function in my application directly?

  • I tried with this function but outcome was same no any changes.

  • Oh, I got what you mean, your 00003f41 GROUP1_IRQHandler is your actual GROUP1_IRQHandler located address, not the one that in the int vector.

    It's OK for this setup.

  • Can i use boot application start_app function in my application directly?

    Yes, you can !

    I tried with this function but outcome was same no any changes.

    Firstly, please check your GPIO interrupt function, based on a normal project, not the project that start address is not 0x0.

    After you verify the GPIO interrupt, you can move the code to 0x3E80 and add bootloader to your 0x0.

    And you need to flash the device twice, please set Flash necessary region in CCS:

    If you can not enter GROUP1_IRQHandler, please check whether you enable GPIO's interrupt in syscfg.

    And here is a standard GPIO interrupt function:

    void GROUP1_IRQHandler(void)
    {
        switch (DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1)) {
            case DL_INTERRUPT_GROUP1_IIDX_GPIOA:
                switch (DL_GPIO_getPendingInterrupt(GPIOA)) {
                    case DL_GPIO_IIDX_DIO13:
                        break;
                    default:
                        break;
                }
                break;
            case DL_INTERRUPT_GROUP1_IIDX_GPIOB:
                switch (DL_GPIO_getPendingInterrupt(GPIOB)) {
                    case DL_GPIO_IIDX_DIO21:
                        gButtonFlag = true;
                        break;
                    default:
                        break;
                }
                break;
            default:
                break;
        }
    }

  • Thanks for suggestion of checking the interrupt by fleshing at 0 but i checked this before and that works fine. there i was toggling the led on interrupt and it worked fine. Same app at 0 worked but not for 3e80.

  • You can refer to this example for move start address to 3E80

    C:\ti\mspm0_sdk_2_04_00_06\examples\nortos\LP_MSPM0G3507\boot_manager\bim_sample_image

  • Thank you ,i will let you know further

  • Sorry but i dont understand what bim does and how it will help me?? can you please describe me

  • Bootmanager is the bootloader example, you can based on this and add your logic into it.

    Also, bim_sample_image is a app code start from not 0x0 address, it's using a timer interrupt and works fine.

    You can download both image to one MSPM0 device, I think everything will go fine.

    Since I don't know the root cause of can not trigger interrupt at your side.

  • Thanks You for the Suggestion, I will try this things and post the update

  • Im using UART as a communication medium between MSPM0 bootloader code and external world(ESP32). My goal is to flesh new firmware hex without debuuger or flesh tools.

    Examples you suggest can fullfil this? Can you help with this?

  • My hex file loaded into flesh using UART as expected and also for data integrity i checked crc of evey hex line sent by Host and compare both rx and calculated crc then write into flesh.

    so writing operation works fine but the issue when making the jump interrupt not work and reset the uc every time, so can you have example or reference ? or solution of my problem ? 

  • C:\ti\mspm0_sdk_2_04_00_06\examples\nortos\LP_MSPM0G3507\boot_manager\bim_sample_image

    C:\ti\mspm0_sdk_2_04_00_06\examples\nortos\LP_MSPM0G3507\boot_manager\boot_manager

    These two example is for your reference.

    Have you seen any jump that causes unable to trigger interrupt in these two example?

  • give me some time i will let you know about this 

  • i build the bim example and start debug of boot_applicatio then pause and load the image of bim primary slot but it was not working as after loading it was erased all flash memory.

  • You need to refer to my previous reply:

    And you need to flash the device twice, please set Flash necessary region in CCS:
  • i refere the example code and follow the Boot Image manager user guide document. First build the Bim example by selecting primary section then in boot application set erase for main and non main then run the debug and in between stop running then loade the image from bim x5800 bin file but just after loading this image it causing  mass erase of the flash memory.

  • Hello helic chi,

    i found important clue about vector table offset register, im seting the vector table offset register SCB->VTOR before jumping to the app at 3e80 but in app i cheked one conditon if VTOR == 0x00003e80 then blink the led at certain time.but it not blink and remain off so this conclude that VTOR not set at 3e80 despite setting in bootloader before jump. so can you help me to set vtor in proper way?

  • Hey,

    Is there any function to write vtor in mspm0?

  • erase for main and non main

    And need with necessary region. with necessary region, it won't call mass erase.

    but it not blink and remain off so this conclude that VTOR not set at 3e80 despite setting in bootloader before jump. so can you help me to set vtor in proper way?

    your jump code almost same as example code, you didn't trigger reset, but jump to resethandler, which shouldn't reset SCB register.

    Does the example code running well from your side?

    Is there any function to write vtor in mspm0?

    In default, vtor is saved in Flash, need to call Flash API to erase at least 1kB flash, this is not convinevnt.

    But you can add vtor offset, set it to RAM, and copy vctor to RAM, then you can write to Vtor with easily access to RAM.

  • No Bim example code not running well ans as i said i dont understand what i have to do with both code.

    as per your suggestion you mean i have to set or move vector table to ram ? by making changes in linker command file?

  • any reference from the bsl examples?

  • No Bim example code not running well ans as i said i dont understand what i have to do with both code.

    as per your suggestion you mean i have to set or move vector table to ram ? by making changes in linker command file?

    BIM and bootloader is already ready for test, no need to modify.

    You need to load them into M0's flash.

    Bothe code and linker don't need to modify.

    any reference from the bsl examples?

    For BSL, please refer to this:

    C:\ti\mspm0_sdk_2_05_00_04\examples\nortos\LP_MSPM0G3507\bsl

    https://www.ti.com/lit/pdf/slaae88

    https://www.ti.com/lit/pdf/slau887

  • I question is if i am able to run the bim and boot application code what is relation between my problem and their they also use the same method to for jump which i use and checks online and found uc of m0+ or uc which support vtor also use same method as mine but my interrupt not wroked after jump so can you give me other solution pls? 

    i checked the bsl example for jump but got nothing found confusing 

  • You can use a valid software to test the interrupt after jumping, this will keep the basic software is OK.

    I can not verify your own software or logic from my side.

    Or we can back to the original question, 

    for those can not enter the interrupt, here are some reference reason:

    1. Didn't enable the GPIO interrupt (IMASK)

    2. Jump in the handler mode(in interrupt)

    3. Didn't enable NVIC

    4. Didn't enable CPU int control bit.

    It seems all these bit have already checked from your side.

    I will think there are logic error of the software, that's why I recommend you to test the valid code example in the MSPM0 SDK.

    to verify the whole thing can work normally.

  • Thanks you for your suggestions,i will check these things one by one and let you know about its status.

  • As per you suggestion i start finding this regster and NVIC releted into reference manual and found that to control the nvic,scb register you must be in privileged mode is that true? and i try to update vtor in main while loop as you suggest no to from handler. so i need to explicitly turn on the privileged mode or not?

    also i enable global inerrupt by calling _enable_irq() function after system init of all peripherals.

    in addition enable interrupt for perticuler peripheral which i used in application.

    i test with sdks uart echo interrupt example at loc 0x3E80 but output was same, reset the uc upon interrupt.

  • nvic,scb register you must be in privileged mode is that true?

    Yes, but don't need special care for privileged mode, normal thread mode is within privileged mode.

    i test with sdks uart echo interrupt example at loc 0x3E80 but output was same, reset the uc upon interrupt.

    Why a peripheral interrupt will cause M0 interrupt?

    what does uc mean?

  • okay but by setting in privileged mode we can assure of that is not the case. so can you tell how and where  i have to set this mode?

    I mean i test the example of uart echo wih out any changes in the code(Except linker command file as you know need to change as where we need to flesh) and fleshed this code via bootloader at 0x3E80 and at the end make jump.

    my issue was the same also when code changes, issue was with interrupt as i said and the root issue of our discussion.

    uc aka micro controller or mcu.

  • okay but by setting in privileged mode we can assure of that is not the case. so can you tell how and where  i have to set this mode?

    Both run in main.c or in IRQhandler is in privileged mode, no need to set.

    Please also try to remove the entry point control in linker file, it's not the necessary one.

    my issue was the same also when code changes, issue was with interrupt as i said and the root issue of our discussion.

    Yes, but no more recommendation from my side, not sure which part influence the function.

    Please try to verify the Flash content is correct (interrupt vector is programmed, code is in the right address)

    Also, for reference, you can try boot application in MSPM0-SDK, to verify the jump function can work on your test board.

  • -uinterruptVectors
    --stack_size=512
    
    
    MEMORY
    {
        FLASH           (RX)  : origin = 0x00003E80, length = 0x00020000
        SRAM            (RWX) : origin = 0x20200000, length = 0x00008000
        BCR_CONFIG      (R)   : origin = 0x41C00000, length = 0x000000FF
        BSL_CONFIG      (R)   : origin = 0x41C00100, length = 0x00000080
    }
    
    SECTIONS
    {
        .intvecs:   > 0x00003E80
        .text   : palign(8) {} > FLASH
        .const  : palign(8) {} > FLASH
        .cinit  : palign(8) {} > FLASH
        .pinit  : palign(8) {} > FLASH
        .rodata : palign(8) {} > FLASH
        .ARM.exidx    : palign(8) {} > FLASH
        .init_array   : palign(8) {} > FLASH
        .binit        : palign(8) {} > FLASH
        .TI.ramfunc   : load = FLASH, palign(8), run=SRAM, table(BINIT)
    
        .vtable :   > SRAM
        .args   :   > SRAM
        .data   :   > SRAM
        .bss    :   > SRAM
        .sysmem :   > SRAM
        .stack  :   > SRAM (HIGH)
    
        .BCRConfig  : {} > BCR_CONFIG
        .BSLConfig  : {} > BSL_CONFIG
    }
    

    this is my linker cmd file code if i remove

    FLASH           (RX)  : origin = 0x00003E80, length = 0x00020000 this or set to 0 then the logic to extract flash address from hex will useless,

    also my question is it will work if i i set the FLASH to 0 then my code will work if i flash at location 0x3E80?

  • also my question is it will work if i i set the FLASH to 0 then my code will work if i flash at location 0x3E80?

    Flash start from 0x00, compiler will place the code start from 0x0.

    You code should work normally, if this doesn't overwrite other function.

  • Yes i know this but my question is using bootloader this code will work for location 0x3E80?

    i think its not, in my code i only change the strarting address of the code and vector table same to this so code generated right and i am flashing this code uisng bootloader also you said my jump function same as boot application fuction but it does not work then where is the fault? complete road blcok for me and unable to find solution 

  • Yes i know this but my question is using bootloader this code will work for location 0x3E80?

    Flash bootloader to 0x3E80 or using bootloader to flash 0x3E80?

    As long as the jump problem is handled properly, both methods are feasible.

  • Flashing the code using bootloader at 0x3E80.

    my jump method is generic and seen online also in TIs example code so where i am wrong ? i dont know

    Writing Hex file data to the flash is right and as expected i share the picture of the memory browser where hex file writen and hex file it self.

    :203E800000802020AD430000E3400000E3400000000000000000000000000000000000002C
    :203EA000000000000000000000000000E34000000000000000000000E3400000E340000099
    :203EC000E3400000E3400000E3400000E3400000E3400000E3400000E3400000E3400000CA
    :203EE00000000000E3400000E34000000000000000000000E3400000E3400000D54200001F
    :203F0000E3400000E3400000E3400000E3400000E3400000E34000000000000000000000CF
    :203F2000E3400000E34000000000000000000000E340000000000000E3400000E3400000D2
    :203F4000B0B500223748384B9C18995C8D00812141516578AD004151A578AD004151E57899
    :203F6000AD0041512579AD0041516579AD004151A579AD004151E579AD004151257AAD00C2
    :203F80004151657AAD004151A57AAD004151E57AAD004151257BAD004151657BAD00415177
    :203FA000A57BAD004151E57BAD004151257CAD004151657CAD004151A57CAD004151E57C42
    :203FC000AD004151257DAD004151657DAD004151A57DAD004151E57DAD004151257EAD004E
    :203FE0004151657EAD004151A47EA40001511B32362AA9D10D4A1346303B0D4C1C6014606A
    :204000000C4B0D4C1C601C63822303650B4B436501600B480160104640380A4901601160E2
    :20402000B0BDC04604804240B8430000D0120A40FE73E7FFA0320A40FFFFFF0F82000400DB
    :204040009480424001800000002A49D084468B071CD1830722D1102A08D370B4103A78C97C
    :2040600078C0103AFBD270BC103238D0042A2CD3082A05D30C2A01D308C908C008C908C008
    :2040800008C908C092072AD0920F22E00B780370491C401C521E22D08B07F7D1C30714D12F
    :2040A0008307D8D0121F12D308C903801B0C4380001D121FF8D20AE008C903701B0A43705C
    :2040C0001B0A83701B0AC370001D121FF4D2121D05D00B780370491C401C521EF9D16046C1
    :2040E0007047FEE7F0B5441C00780023082B30D02578C6070FD166782D0137097F190F25EF
    :204100003540ED1C122D0BD102256657F5B2002E08D4E61C0CE0641C4E1C0D70314615E0B0
    :20412000A61C06E0261DE4787F221540E20155191235094A97420ED0FC43002D05D00A5DF8
    :204140004F1C0A706D1E3946F7E7344640085B1CCCE72046C7E7F0BDFF0F000010B51649B3
    :20416000164C204600F006F91549204600F056F8144802680321C9038A4301210B04D218E8
    :2041800002600269104B13405A1C026142690923134336229343436142680A4043688B435F
    :2041A0009A184260094A13688C021C43146002680A43026010BDC046F84300000080104085
    :2041C000EE430000009110400000FFFF2890104010B50F48012181630E4A136804241C434B
    :2041E0001460021F13684C05A34313600A4A002313600246083A13680324E4431C401460F8
    :2042000002688A430260026809028A43026010BD08010B4010ED00E008030B4070B51122B5
    :204220001302C218C4580125AC43C4500C888D7825438C882C43C558084E2E40084D25402B
    :204240007419C4508879CB790343087A184351687E23994318400818506070BDE798FDFF4F
    :204260001867000070B50A480A4C84420CD00A4D0A4EB54208D02A686968501C12789200E7
    :20428000A25890470835F4E700BF00BF70BDC0460844000000440000104400001844000044
    :2042A00080B5074807494160074A5160074B59600749016011601960102000F06DF880BD1F
    :2042C00000080A40030000B100280A40008810400100002607480068C0B20B2808D10648E4
    :2042E0000649016006484168064A1170117801607047C04620901040B0120A400180000012
    :20430000209110400000202000F02AF862B60120C003064908600649086006480168022205
    :204320000A43026030BF30BF30BFFBE780E200E000E100E010ED00E0084880F3088800BF2D
    :2043400000BF00F035F8002801D0FFF78BFF0020FFF7DAFF012000F02DF8C046008020201D
    :2043600080B5FFF79DFFFFF7EBFDFFF731FFFFF7F5FE80BD10B50122120383180C789C6034
    :204380004978815010BD80B50B4603214258C11D184600F007F880BD811E091F00BFFCD2BE
    :1843A0007047000080B5FFF74FFE80BDC4E770470120704700BFFEE7BB
    :2043B8001D1E1F202122232526272A2B2C2D2E2F303132333435363738393A3B01020304FC
    :2043D80005060708090A0B0C0D0E0F10111213161718191A1B1C000018000000003000001A
    :0843F8000200000000000000BB
    :18440000E540000087430000000100FFF0000000084400000000202039
    :00000001FF

    Jump function is same as boot application example or better then that.

  • reset the uc upon interrupt.

    Can you read the reset cause at the beginning at main? and try to send it out such as via UART?

    This will help you find the reset root cause.

    2.6.36 RSTCAUSE (Offset = 1220h)

    Writing Hex file data to the flash

    Yes, seem correct, and you are using UART0.

  • Hello helic,

    As per your recent suggestion of runing BIM and Boot Application and i tried this two running again and its works fine, so what kind of conclusion i have to take from this and what i need to change in my source code from this?

    Okay but if the mcp got reset upon interrupt then where i have to read the reset cause is there any function which is called before the reset of uc when error or hard fault occures? i tried with hard fault error handler but it not called upon this error.

  • Hello helic,

    i put condition of SCB->VTOR == 0x5800 then set the led and it was set so VTOR setting success in boot application but not in my despite using the same function which is used in boot application, so that is the root cause of mcp getting reset upon interrupt of flashed application.

    so how can i write to vtor? i told about PRIVILEGED mode is the need?

  • As per your recent suggestion of runing BIM and Boot Application and i tried this two running again and its works fine

    It's great to hear this.

    so what kind of conclusion i have to take from this and what i need to change in my source code from this?

    Please compare these two example carefully.

    You can modify this BIM + Boot application example to your code structure step by step and test every step, to replace the original logic and boot in your project.

    is there any function which is called before the reset of uc when error or hard fault occures?

    Please try to catch NMI or hardfault handler, but not every error will run into these two handlers.

    But you can still read resetcause register at the beginning of main function.

    so how can i write to vtor? i told about PRIVILEGED mode is the need?

    Method 1, try to find the right way to modify the VTOR in app code:

            Privileged mode is the CPU mode from Arm Cortex M0+ core's content, you can find the related information in ARM website, M0+ TRM.

    Method 2, from my side:

            Set boot int vector start from address 0x00, boot can successfully jump to app, and using manually triggered Reset to jump form app back to boot.