Hi all,
i have a device with a uTasker Bootlader an MQX lite. I have change the Memory map of the firmware :
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00008080, LENGTH = 0x00000200
m_cfmprotrom (RX) : ORIGIN = 0x00008400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00008410, LENGTH = 0x00037BF0
m_data (RW) : ORIGIN = 0x1FFFE200, LENGTH = 0x00007E00
}
I know that MQX can copy the interrupt to RAM with the setting MQX_ROM_VECTORS set to 0 in user_config.h. This is necessary for a correct functioning because at 0x00 address i have the bootlaoder. Although this setting the system crash as visible in the image when is execute
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
in PE_low_level_init.
Thanks
PS: the system crash in
void _psp_int_install(void)
{
KERNEL_DATA_STRUCT_PTR kernel_data;
_GET_KERNEL_DATA(kernel_data);
__set_MSP((uint_32)kernel_data->INTERRUPT_STACK_PTR);
#if !MQX_ROM_VECTORS
{
uint_32 i;
uint_32_ptr ptr = (pointer)(&__vect_table);
/* Initialize the hardware interrupt vector table
* 0: Initial stack pointer
* 1: Initial program counter
*/
for (i = 16; i < PSP_MAXIMUM_INTERRUPT_VECTORS; i++) {
ptr[i] = (uint_32)_int_kernel_isr;
}
}
#endif
}
when the ptr[i] = (uint_32)_int_kernel_isr; is executed
If i change the setting MQX_ROM_VECTORS to 1 and add this code in __init_hardware during the initialization
uint32_t *pdst;
uint32_t *psrc;
uint16_t i;
// Then redirect the vector table to RAM by changing the SCB_VTOR like this:
// Redirect the vector table to the new copy in RAM
SCB_VTOR = (uint32_t) (0x1FFFE000);
// Copy Application Stored Interrupt Vector table to RAM
pdst = (uint32_t*) (0x1FFFE000);
psrc=(uint32_t*) (0x8080);
for (i = 0; i < 0xC0; i++, pdst++, psrc++) {
(*pdst) = (*psrc);
}
// Check Copy
pdst = (uint32_t*) (0x1FFFE000);
psrc=(uint32_t*) (0x8080);
for (i = 0; i < 0xC0; i++, pdst++, psrc++) {
if ((*pdst) != (*psrc)) {
// error
while (1) {}
}
}
that copy the interrupt table from flash to ram the code is executed but only for a short time, in my function init
void Init_Device(void) {
int error = 0;
unsigned int firmware_version_SdCard = 0;
unsigned int i = 0, bw = 0;
/*
* Parte di inizializzazione periferiche del dispositivo
* ADC, SPI, SDCard
*/
//Cpu_SetClockConfiguration(0); //setto la cpu alla massima frequenza
Ref_EN_SetVal();//abilito il MOS sul riferimento del ADC
//resetto la SdCard agendo sulla alimentazione
SDCard_ON_ClrVal();
WAIT_Waitms(10);
SDCard_ON_SetVal();
when is executed the wait function the cpu crash .... i think is a problem with the systemtimer interrupt of MQX. The crash is visible in the image
Thanks
Hi,
during the __init_hardware i copy the interrupt vector from flash to ram but when the MQX lite is executed with PEX_RTOS_START(); the SCB_VTOR change and return to a wrong value ... Why? Thanks
Hello Daniele Cortellazi:
I think your copy to RAM is not correct, you should increment both pointers by 4 with each iteration (pdst and psrc).
Apart from that I recommend you to instead give a try to the workaround described in the next post:
How to put vectors in ram with processor expert?
You have the same problem, although I did not try the solution with a bootloader-ready project.
Regards!
Jorge Gonzalez
Setting MQX_ROM_VECTORS to 0 in user_config.h the copy of the interrupt in RAM is not automatic?
Thanks
Hi Daniele:
In the case of MQX Lite, user_config.h is handled by Processor Expert and there is a bug in MQX Lite component that does not allow to install vectors in RAM automatically, you have to apply the workaround of the other thread.
I am sorry for the inconvenience.
Regards!
Jorge Gonzalez