AnsweredAssumed Answered

FSL Kinetis Bootloader K80 Tools Example Problem

Question asked by John Newton on Oct 11, 2017

Using:

KDS 3.2.0

FSL_Kinetis_Bootloader_K80_Tools_1_0_0

FRDM K82F

Kinetis Bootloader QuadSPI User's Guide.pdf Rev0

 

Issue Summary:

Using led_demo_qspi example, adding simple code to the example will prevent the device from booting from external flash memory

 

 

Issue Detail:

I have followed the QuadSPI User Guide and built the led_demo_qspi example using KDS 3.2.0 GCC.  I have encrypted the file and programmed the external flash with the encrypted image and the LED flashes as per the example.  All good.

 

I have added code to the main function after the clocks have been switched and the hardware has been initialised.  

 

The code I have added is multiple lines of __asm("nop"); to simplify the issue I am having, same occurs with any other code.

 

Depending on the number of NOP's added will effect if the processor will successfully boot from external flash. 

 

So you will see in the following code snippet that I am executing 8 NOP instructions, this results in the boot sequence resetting the processor as seen by the reset LED on the FRDM board momentarily flashing.  If I add no NOP's the processor boots and correctly flashes the LED's.  If I add 10 NOP's the processor correctly boot's.

 

Again, the is an example project found in the FSL_Kinetis_Bootloader_K80_Tools_1_0_0, the only code I have added is NOP's.  The linker and project settings are all from the example. 

 

I have included my project as an attachment.

 

If any one can help with this I would be very grateful.

 

John

 

 

 

<code>

int main(void)
{
copy_to_ram();
clock_change();
hardware_init();
milliseconds_delay_init();
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Not working
__asm("nop"); //Not working
__asm("nop"); //Not working (reset LED flash)
/*__asm("nop"); //Not working (reset LED flash)
__asm("nop"); //Not working
__asm("nop"); //Not working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Not working
__asm("nop"); //Not working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working

__asm("nop"); //Working
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Not working (reset LED flash)
__asm("nop"); //Not working (reset LED flash)
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Working

__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Working
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Not working (no reset LED flash)
__asm("nop"); //Working
/* */
uint32_t led_idx = LED0;
while(1)
{
led_toggle(led_idx);
milliseconds_delay(1000);
led_toggle(led_idx);
led_idx <<= 1;
if(led_idx > MAX_LED_IDX)
{
led_idx = LED0;
}

// Re-enter bootloader if the bootloader pin is asserted.
if (is_bootloader_pin_asserted())
{
app_enter_bootloader();
}
}
}

</code>

Original Attachment has been moved to: led_demo_qspi_project_export_from_KDS.zip

Outcomes