LPC55S06 custom bootloader doens't jump to application

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPC55S06 custom bootloader doens't jump to application

1,379件の閲覧回数
MarcoGiammarini
Contributor III

Hi, 

we developed a custom bootloader for the LPC55S06 (we know that the microcontroller has a bootloader inside). The bootloader is at 0x0 and the application is at 0xE000. The application was relocated at this address by using linker script. 

When the bootloader start, everything is ok until the jump to the application where it jump into a RAM address. We can't understand why. The code is the same that we use a lot of times for M4 and M0 core.

The code is the following:

 

    static uint32_t s_stackPointer = 0;
    uint32_t  *vect_mem = 0;
    vect_mem = (uint32_t*)APP_VECTOR_TABLE;

    s_stackPointer = vect_mem[0];
    static void (*farewellBootloader)(void) = 0;
    farewellBootloader = (void (*)(void))vect_mem[1];

    if (is_valid_application_location((uint32_t)farewellBootloader))
    {
        GPIO_PinWrite(BOARD_INITPINS_LED_ACTIVE_GPIO,
                        BOARD_INITPINS_LED_ACTIVE_PORT,
                        BOARD_INITPINS_LED_ACTIVE_PIN,1);
    	// Set the VTOR to the application vector table address.
    	SCB->VTOR = (uint32_t)vect_mem;

    	// Set stack pointers to the application stack pointer.
    	__set_MSP(s_stackPointer);
    	__set_PSP(s_stackPointer);

    	// Jump to the application.
        farewellBootloader();
    }
    else
    {
        // TODO app is not valid
        while(1){
            GPIO_PortToggle(BOARD_INITPINS_LED_ERROR_GPIO,
                            BOARD_INITPINS_LED_ERROR_PORT,
                            (1 << BOARD_INITPINS_LED_ERROR_PIN));

        App_mDelay(1000);
        }
    }

 

where #define APP_VECTOR_TABLE 0x0000E000

Where is the error?!

Best,

Marco

ラベル(1)
0 件の賞賛
返信
11 返答(返信)

1,251件の閲覧回数
MarcoGiammarini
Contributor III

Hi @Alice_Yang 

is it possible that the problem is the REDLIB? We can't find any other ideas to solve the issue.

BR

Marco

0 件の賞賛
返信

1,226件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @MarcoGiammarini 

Share your application project.

 

BR

Alice

0 件の賞賛
返信

1,224件の閲覧回数
MarcoGiammarini
Contributor III

Hi @Alice_Yang 

Can I share in a private way?

0 件の賞賛
返信

1,211件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @MarcoGiammarini 

I received your projects. Which IDE do you used?

After import it into MCUXprsso IDE, it seems not works well. Not shows the code you mentioned above.

Just as below:

Alice_Yang_0-1709713761985.png

Also linker file not right. 

 

BR

Alice

 

0 件の賞賛
返信

1,199件の閲覧回数
MarcoGiammarini
Contributor III

Sorry @Alice_Yang , I miss some parts of the project. Usually we save the application code outside the project. I'll send you now the correct version!

BR

Marco

0 件の賞賛
返信

1,145件の閲覧回数
MarcoGiammarini
Contributor III

Hi @Alice_Yang 

Did you find anything on my code? I don't have any other ideas to fix it!

BR

Marco

0 件の賞賛
返信

1,108件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @MarcoGiammarini 

How about send a project that I can directly build. You can send your project to others to test first.

Without any change, on my side:

Alice_Yang_0-1710654696216.png

 

 I think maybe there is issue with the linker file of application project. While project can not build well on my side, so I don't know which linker file do you used. Use IDE to config? Or use the files under linkscripts folder?

Alice_Yang_1-1710654842397.png

 

BR

Alice

 

 

0 件の賞賛
返信

1,087件の閲覧回数
MarcoGiammarini
Contributor III

Hi @Alice_Yang 

I am so sorry, but from my side both project compile well with MCUXpresso. I tried different PC to check it.

MarcoGiammarini_0-1710756560677.png

For the application project, I am using the linker file inside the folder of your screenshot. When I compile for using the application without the bootloader I am using the configuration without the _BOOT at the end, instead when I compile the application project to put it on the specific part where the bootloader jump I am using the configuration with _BOOT at the end.

Thanks for yuor help

BR

Marco

0 件の賞賛
返信

1,068件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @MarcoGiammarini 

Because I can not build your project on my side, recommend you use a simple led SDK project, not your own project.  confirm it can works well. Then change flash start address to 0xE000. Build, confirm the .hex file start address is 0xE000. Program it into your chip. Then use bootloader to test. 

 

BR

Alice

0 件の賞賛
返信

1,334件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @MarcoGiammarini 

1) I haven't find issue with your code.

You can first test whether application can well without bootloader. To do this, edit the launch configuration (by double clicking on the .launch file that will have been created in your project) and change the "reset handling" option to "SOFT".

Alice_Yang_0-1708497105975.png

Detail you can refer to:

https://community.nxp.com/t5/LPC-Microcontrollers/Lpc845-app-code-can-t-debug-after-bootloader/m-p/8... 

2) Pay attention do not erased application code when program bootloader project.

 

BR

Alice

 

0 件の賞賛
返信

1,332件の閲覧回数
MarcoGiammarini
Contributor III

Hi @Alice_Yang 

thanks for yuor reply.

On the launch file, there isn't the flag that you mention:

MarcoGiammarini_0-1708512219396.png

Can I do/check other flags?

BR

Marco

0 件の賞賛
返信