Hello, Dear ZhangJennie
I have already modified the start address of my application Program Flash in Memory Configuration Editor and disabled automatic placement of Flash Configuration Field in image (since it is already defined in my bootloader Flash portion), but it didn't work. When I load my application Flash with my application code, it runs the application, but it looks like it doesn't recognize interrupts somehow.
I have tested my (customized) bootloader with SDK demo codes "frdmk64f_driver_examples_adc16_interrupt" and "frdmk64f_driver_examples_gpio_input_interrupt". Both are successfully written into application Flash memory, but they don't run properly.
The "frdmk64f_driver_examples_adc16_interrupt" while loop is:
while (1)
{
GETCHAR();
g_Adc16ConversionDoneFlag = false;
ADC16_SetChannelConfig(DEMO_ADC16_BASE, DEMO_ADC16_CHANNEL_GROUP, &adc16ChannelConfigStruct);
while (!g_Adc16ConversionDoneFlag)
{
}
PRINTF("ADC Value: %d\r\n", g_Adc16ConversionValue);
PRINTF("ADC Interrupt Count: %d\r\n", g_Adc16InterruptCounter);
}
One of the tests I have done was removing the lines relating "ADC16_SetChannelConfig" function call and "while(!g_Adc16ConversionDoneFlag){}". After that, when I press any key from PC, the two messages are displayed in the Terminal. On the other hand, if I leave the code as it is, the introduction messages are displayed, but the other messages printed in while loop, are not, no matter the key pressed in PC.
The "frdmk64f_driver_examples_gpio_input_interrupt" doesn't work as well. But, if my bootloader loads demo codes without any interrupts like "frdmk64f_driver_examples_adc16_polling" or "frdmk64f_driver_examples_gpio_led_output", they run perfectly without issues and perfectly loads and runs application codes that were built in KDS (with or without interrupts), what leads me to suspect that the interrupts, somehow, were not correctly relocated to the new Program Flash address in application codes in MCUXpresso.
I don't know how the vector table is allocated by MCUXpresso. In KDS, as I said previously, we have a "m_interrupts" section in the linker, where we can modify its starting address. In MCUXpresso, we just have Program Flash. I believe that it is because it already considers the start of vector table area as the start of Program Flash.
I tried to expose my issue as clearly as possible, but if I was not clear enough, please let me know! Can you give me a helping hand on this please?
Thanks and best regards,
Marco Coelho
DFAE - Siletec Eletronica