Hi All,
I have an old application project for LPC1114 that is fully working with LPCXpresso v7.7.2, recently l have imported the project to MCUXpresso v 11.1.1 and the same project is not working anymore.
This is a bootloader (MFlash32 (rx) : ORIGIN = 0x00000000, LENGTH = 0x3000) and application (MFlash32 (rx) : ORIGIN = 0x00003000, LENGTH = 0x4000) based scenario. I have observed that jump from Bootloader to the application is looking fine and then it lost in the application (jump to "0xfffffffe") once I enable any interrupt like timer or UART. Before jump to the application in the bootloader, all interrupts are disabled.
From the previous posts, I came to know that this may be related to vector remapping. The application has a remapping vector function that copies the interrupt vector from flash (0x00003000) to RAM and changes the status of SYSMEMREMAP accordingly. The declaration of the variable that is used for copy is following
static UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));
So now I need help why the same working project stops working with MCUXpresso v 11.1.1 (or even not working with LPCXpresso v8.1.0_597 as well)?
Does this relate to the GCC compiler?
Hello RizwanA,
How about do not copy interrupt vector from flash to RAM?
You can also attach your project, I help to check on my side.
BR
Alice
Hi @Alice_Yang ,
thanks for the quick reply,
Unfortunately, I can not upload the full project but the function that copies the vector table from flash to RAM is the following.
#define VTABLE_USER_RAM_MODE (0x01)
#define APP_START_ADDR 0x00003000
#define REMAP_VECTOR_COUNT (52)
static UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));
static void RemapVectorTable(void)
{
UINT16 unIndex = 0;
UINT32 *punFlashVectTable = (UINT32 *)APP_START_ADDR;
/* Disable interrupts before re-mapping interrupt vector table */
__disable_irq();
/* Copy the interrupt vector table to RAM */
for (unIndex = 0; unIndex < REMAP_VECTOR_COUNT; unIndex++)
{
aunRamVectTable[unIndex] = punFlashVectTable[unIndex];
}
/* Indicate that the vector table has been remapped to SRAM */
LPC_SYSCON->SYSMEMREMAP = VTABLE_USER_RAM_MODE;
/* Re-enable interrupts */
__enable_irq();
}
Like I said above that the project is fully working with LPCXpresso v7.7.2_379 and also up to LPCXpresso v8.0.0_526 and stop working with LPCXpresso v8.1.0_597 and afterward.
One more thing I have observed that in the map file generated by MCUXpresso IDE v11.1 the vtable section is not mapped to address 0x10000000 plus also the size of .data (0x20) shows that the "aunRamVectTable" is not mapped correctly.
Whereas in the map generated by LPCXpresso v7.7.2 they look correctly mapped.
Is the following declaration of aunRamVectTable correct? Maybe there is something wrong that is exposed to the latest GCC?
static UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));
Hello RizwanA,
About place the data into RAM, you can try to refer to MCUXpresso IDE User Guide to test:
<MCUXpresso_IDE_User_Guide.pdf> ->
17.13.2 Placing data into different RAM blocks using Macros
BR
Alice
Hi Alex,
I have tried the macros as well but the result is the same, the only solution I found is if I add in "volatile" to the variable(aunRamVectTable) then it works and also visible in the map file that "vtable" contains this variable
static volatile UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));
I don't know why this is working? is this a known issue, that if "volatile" is not used then the mapping of a variable to ram will not work?
Hi @Alice_Yang ,
thanks for the quick reply,
Unfortunately, I can not upload the full project but the function that copies the vector table from flash to RAM is the following.
#define VTABLE_USER_RAM_MODE (0x01)
#define APP_START_ADDR 0x00003000
#define REMAP_VECTOR_COUNT (52)
static UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));
static void RemapVectorTable(void)
{
UINT16 unIndex = 0;
UINT32 *punFlashVectTable = (UINT32 *)APP_START_ADDR;
/* Disable interrupts before re-mapping interrupt vector table */
__disable_irq();
/* Copy the interrupt vector table to RAM */
for (unIndex = 0; unIndex < REMAP_VECTOR_COUNT; unIndex++)
{
aunRamVectTable[unIndex] = punFlashVectTable[unIndex];
}
/* Indicate that the vector table has been remapped to SRAM */
LPC_SYSCON->SYSMEMREMAP = VTABLE_USER_RAM_MODE;
/* Re-enable interrupts */
__enable_irq();
}
Like I said above that the project is fully working with LPCXpresso v7.7.2_379 and also up to LPCXpresso v8.0.0_526 and stop working with LPCXpresso v8.1.0_597 and afterward.
One more thing I have observed that in the map file generated by MCUXpresso IDE v11.1 the vtable section is not mapped to address 0x10000000 plus also the size of .data (0x20) shows that the "aunRamVectTable" is not mapped correctly.
Whereas in the map generated by LPCXpresso v7.7.2 they look correctly mapped.
Any suggestion why vtable is not mapped correctly anymore?
Is there any mistake in the following declaration? which may expose with the latest GCC version?
static UINT32 aunRamVectTable[REMAP_VECTOR_COUNT] __attribute__ ((section ("vtable")));