Mirroring the vector table(bootloader)

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

Mirroring the vector table(bootloader)

1,775 次查看
ambarishhundeka
Contributor III

HI@,

We are using s32K118 controller . i need to port the bootloader of Renesas to NXP.

Problem 1:

#pragma vector=0x3E
#pragma optimize=low
__interrupt void OSIRQ_Int31(void) @ "IRQ_VECTOR"
{ ((BL_pfvVirtualIrqAddr)(*(T_U16 __far *)(BL_nu32AppIVTBaseAddr + 0x3E))) (); }

this is one interrupt function used to create the mirror vector table for Renesas(used IAR Tool).

How to port the above mirror function for NXP controller.

the above syntax are specific to IAR compiler.

we are using S32K design studio, how to port the above function in the design studio?

Problem 2:

#pragma dataseg="BL_DATA_RAM"
__no_init T_U32 BL_gau32TM_Timer[BL_TIMER_MAX_NO_OF_TIMERS];
__no_init T_BOOL BL_gbDAACFlag;
__no_init u8BLCState_t BL_gu8BLCState;
__no_init u8DLTState_e BL_gu8DLTState;
__no_init u8BaudRate_e BL_gu8BaudRate;

The above code has written in IAR tool.

same code I used it in S32 Design studio, it is showing syntax error because of __no_init.

How to rewrite the above declaration in S32 design supportable format?

Thanks in advance for the help.

Kindly help us in this.

Regards,

Ambarish

0 项奖励
回复
2 回复数

1,181 次查看
stanish
NXP Employee
NXP Employee

Hello Ambarish,

The default compiler for S32 Design Studio is GCC. You can find the GCC compiler manual on the Internet or in S32DS local folder:

<S32DS_ARM>\Cross_Tools\gcc-arm-none-eabi-4_9\share\doc\gcc-arm-none-eabi\pdf\gcc\gcc.pdf

Regarding interrupts:

Due to ARM cortex core design an interrupt handler routine written in C does not differ from a C subroutine. 

Therefore you don't need any "interrupt" key word support by the compiler.

All you need to do is correctly calculate the address of redirected handler and place the handler name it into the vector table e.g.:

pastedImage_8.png

Regarding to "no init" variables:

I'd suggest you to create a separate section for uninitialized variables e.g. "m_no_init" + ".NO_INIT_DATA_RAM":

MEMORY
{
  /* Flash */
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010
  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0

  /* SRAM_L */
  m_no_init             (RW)  : ORIGIN = 0x1FFF8000, LENGTH = 0x00001000  
  m_data                (RW)  : ORIGIN = 0x1FFF9000, LENGTH = 0x00007000
  
  /* SRAM_U */
  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

/* Define output sections */
SECTIONS
{
  .NO_INIT_DATA_RAM :
  {        
    . = ALIGN(4);
    KEEP(*(.NO_INIT_DATA_RAM))  /* Keep section even if not referenced. */
  } > m_no_init
  ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Then you can create a macro that places the variable into this section:

#define __NO_INIT __attribute__((section(".NO_INIT_DATA_RAM")))
__NO_INIT char str[10];‍‍

Another approach is to add the section into .data but then you can adjust the startup routine to avoid the copy-down for this subsection.

Hope it helps.

Stan

0 项奖励
回复

1,181 次查看
ambarishhundeka
Contributor III

Hi ,

Kindly reply to the above post or send me the standard S32 compiler reference manual.

Regards,

Ambarish B H

0 项奖励
回复