How can I get bootloader example for S32K3XX

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How can I get bootloader example for S32K3XX

跳至解决方案
2,280 次查看
zp001
Contributor III

Hello NXP team,

we are developing bootloader for S32K314 and we'd like to know how to get bootloader example?

Thanks!

标记 (1)
0 项奖励
回复
1 解答
2,272 次查看
Senlent
NXP TechSupport
NXP TechSupport
0 项奖励
回复
3 回复数
2,064 次查看
lihuagang
Contributor II

Hello,Sir!This  is my attachment,Thanks!

0 项奖励
回复
2,273 次查看
Senlent
NXP TechSupport
NXP TechSupport
0 项奖励
回复
2,065 次查看
lihuagang
Contributor II

Hello,Sir!This  attachment is my s32k312 bootloader&app project,but it cannot run properly!Could you  help me take a look at how to modify this code,please! Also, the Unified Bootloader Demo  is looks at  difficult. Can you provide me with a simpler example?

/* bootloader_linker */
MEMORY 
{         
    int_flash               : ORIGIN = 0x00400000, LENGTH = 0x00010000    /* 2048K - 176K (sBAF + HSE)*/
    int_itcm                : ORIGIN = 0x00000000, LENGTH = 0x00008000    /* 32K */
    int_dtcm                : ORIGIN = 0x20000000, LENGTH = 0x00010000    /* 64K */
    int_sram                : ORIGIN = 0x20400000, LENGTH = 0x00006F00    /* 27 KB */
    int_sram_fls_rsv        : ORIGIN = 0x20406F00, LENGTH = 0x00000100    
    int_sram_stack_c0       : ORIGIN = 0x20407000, LENGTH = 0x00001000    
    int_sram_no_cacheable   : ORIGIN = 0x20408000, LENGTH = 0x00007F00    /* 32kb , needs to include int_results  */
    int_sram_results        : ORIGIN = 0x2040FF00, LENGTH = 0x00000100    
    int_sram_shareable      : ORIGIN = 0x20410000, LENGTH = 0x00008000    /* 32KB */
    ram_rsvd2               : ORIGIN = 0x20418000, LENGTH = 0             /* End of SRAM */
}

/*bootloader_main.c*/
/* ==========  define var ========== */
#define APP_START_ADDRESS	 (0x000410000 + 0x200) //app开始地址
/*===========  LOCAL FUNCTIONS =========*/
void Bootup_Application(const uint32_t app_StarAddress);
void init_ram(void);
void TestDelay(uint32 delay);

void TestDelay(uint32 delay)
{
    static volatile uint32 DelayTimer = 0;
    while (DelayTimer<delay)
    {
        DelayTimer++;
    }
    DelayTimer=0;
}



/**
* @brief        Main function of the example
* @details      Initializez the used drivers and uses the Icu
*               and Dio drivers to toggle a LED on a push button
*/
int main(void)
{
    uint8 count = 0U;


    /* Initialize all pins using the Port driver */
    Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);

    while (count++ < 5)
    {
        Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 1U);
        TestDelay(4800000);
        Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 0U);
        TestDelay(4800000);
    }

    /* 清空ECC */
    init_ram();

    /* 执行跳转 */
    Bootup_Application(APP_START_ADDRESS);

    return (0U);
}


#define	STDBYRAM_START		0x20400000
#define	STDBYRAM_END		0x20418000
#define STDBYRAM_SIZE		(STDBYRAM_END - STDBYRAM_START)

void init_ram(void)
{
	uint32_t	cnt;
	uint64_t	*pDest;

    cnt = (( uint32_t)(STDBYRAM_SIZE)) / 8U;
    pDest = (uint64_t *)(STDBYRAM_START);
    while (cnt--)
    {
		*pDest = (uint64_t)0x00;
		pDest++;
    }
}

/*
 * start_Bootup_Application
 * */
void Bootup_Application(const uint32_t app_StarAddress)
  {
	uint32_t appEntry, appStack;
  	static void (*jump_to_application)(void);

    /* 获取栈地址 */
    appStack = *((uint32_t *)(app_StarAddress));

    /* 获取app入口地址 */
    appEntry = *((uint32_t *)(app_StarAddress + 4));

  	/*把应用程序入口地址赋值给函数指针*/
  	jump_to_application = (void (*)(void))appEntry;

  	/* 重新定向中断向量表 */
  	S32_SCB->VTOR = (uint32_t)app_StarAddress;

  	/* 关闭全局中断    ASM_KEYWORD("cpsid i");   */
  	__asm volatile ("cpsid i" : : : "memory");

  	/* 设置栈指针  */
  	__asm volatile ("MSR msp, %0\n" : : "r" (appStack) : "memory");
  	__asm volatile ("MSR psp, %0\n" : : "r" (appStack) : "memory");

  	/*跳转*/
  	jump_to_application();
	while (1)
	{
		Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 1U);	/* 运行到此处说明发生错误 */
	}
}

/* app_linker */
MEMORY 
{         
    int_flash               : ORIGIN = 0x00400000 + 0x00010000 + 0x200, LENGTH = 0x001D4000 - 0x00010000 - 0x200  /* 2048K - 176K (sBAF + HSE)*/
    int_itcm                : ORIGIN = 0x00000000, LENGTH = 0x00008000    /* 32K */
    int_dtcm                : ORIGIN = 0x20000000, LENGTH = 0x00010000    /* 64K */
    int_sram                : ORIGIN = 0x20400000, LENGTH = 0x00006F00    /* 27 KB */
    int_sram_fls_rsv        : ORIGIN = 0x20406F00, LENGTH = 0x00000100    
    int_sram_stack_c0       : ORIGIN = 0x20407000, LENGTH = 0x00001000    
    int_sram_no_cacheable   : ORIGIN = 0x20408000, LENGTH = 0x00007F00    /* 32kb , needs to include int_results  */
    int_sram_results        : ORIGIN = 0x2040FF00, LENGTH = 0x00000100    
    int_sram_shareable      : ORIGIN = 0x20410000, LENGTH = 0x00008000    /* 32KB */
    ram_rsvd2               : ORIGIN = 0x20418000, LENGTH = 0             /* End of SRAM */
}

/* app_main.c  */
void TestDelay(uint32 delay);
void TestDelay(uint32 delay)
{
    static volatile uint32 DelayTimer = 0;
    while (DelayTimer<delay)
    {
        DelayTimer++;
    }
    DelayTimer=0;
}

/**
* @brief        Main function of the example
* @details      Initializez the used drivers and uses the Icu
*               and Dio drivers to toggle a LED on a push button
*/
int main(void)
{
    /* Initialize all pins using the Port driver */
    Siul2_Port_Ip_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);

    while (1)
    {
        Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 1U);
        TestDelay(4800000);
        Siul2_Dio_Ip_WritePin(LED_PORT, LED_PIN, 0U);
        TestDelay(4800000);
    }

    //Exit_Example(TRUE);
    return (0U);
}

 

标记 (1)
0 项奖励
回复