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