S32k3 binary flash

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32k3 binary flash

1,916 Views
vikmonti7804
Contributor III

Hi,

    I am using the eval board S32K312EVB-Q172 with PE micro universal debugger and i want to flash the HSE fw binary to the controller but i dont see any option in s32ds which support this feature.

I also tried the debug configuration changes and replaced the .elf file by .bin file but its not working.

Can you please provide any help to flash the binary file to the controller with the debugger.

0 Kudos
Reply
3 Replies

1,902 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @vikmonti7804 

Pemicro does not support raw binary files. It supports elf/hex/srec:

https://community.nxp.com/t5/S32-Design-Studio-Knowledge-Base/HOWTO-download-separate-elf-srec-hex-f...

As a workaround, you can use the same way as in example S32K344_HSE_FW_INSTALL mentioned in previous thread. The bin file is included to the project via linker file. Or use some different programmer/debugger which support this feature.

Regards,

Lukas

0 Kudos
Reply

1,842 Views
vikmonti7804
Contributor III

Hi Lucas,

         I am trying to import a simple binary of toggle led in one of the project , there no use of hse, i just need to flash this binary with some simple code, can you please help. 

please fins the image of the linker file of the project which is importing the binary.

I need support for the code to be written in the project main function  so that program can jump to the application binary address to execute it and we can see the toggle led on the board.

Kindly help

vikmonti7804_0-1708406520124.png

 

0 Kudos
Reply

1,832 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @vikmonti7804 

Let me re-use text about jumping from bootloader to application I wrote earlier - see below. In addition, be aware that it's necessary to de-initialize all the features used by bootloader, especially it is necessary to disable interrupts on all levels - in the core, by local enable bits in peripherals, clear pending interrupts...

 

*********

In case of ARM devices, stack pointer is initialized automatically after reset using “Initial SP value” in the vector table:

lukaszadrapa_0-1708442530059.png

 

So, bootloader’s code should initialize the stack pointer as a first step and then it can jump to the application.

 

Here is an example from application note AN12218 S32K1xx Bootloader:

 

/* Start address for the application received by the bootloader

 * application vector table should start at this address

 * */

#define APP_START_ADDRESS    0x1000

 

/**

 * Used to jump to the entry point of the user application

 * The Vector table of the user application must be located at 0x1000

 *

 * */

void JumpToUserApplication( unsigned int userSP,  unsigned int userStartup)

{

                /* Check if Entry address is erased and return if erased */

                if(userSP == 0xFFFFFFFF){

                                return;

                }

 

                /* Set up stack pointer */

                __asm("msr msp, r0");

                __asm("msr psp, r0");

 

                /* Relocate vector table */

                S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

 

                /* Jump to application PC (r1) */

                __asm("mov pc, r1");

}

 

And here is an example from application note AN12323 S32K1xx Firmware updates:

 

void JumpToApplication(uint32_t start_address)

{

    void (*entry)(void);

    uint32_t pc;

    uint32_t __attribute__((unused)) sp;

 

    S32_SCB->VTOR=(uint32_t)(start_address);      /*Relocate interrupt table ptr*/

    sp = *((volatile uint32_t*)start_address);

    asm(" ldr sp, [r0,#0]");

    pc = *((volatile uint32_t *)(start_address + 4));

    entry = (void (*)(void))pc;

    entry();

}

0 Kudos
Reply