Hi guys,
I'd like to set up the BCA of the KL03. According to my knowledge, it should reside in the startup_MKL03Z4.S file but I don't know which part of the file should be edited. An example would also be very much appreciated.
Thanks in advance!
- Laci
Solved! Go to Solution.
In the meantime, I've downgraded to KDS and I can confirm that the lack of the "used" attribute was the culprit. The following works:
__attribute__((used, section(".BootloaderConfig"))) const bootloader_config_t BootloaderConfig = {
.tag = 0x6766636B, // Magic Number
.enabledPeripherals = 0xE2, // Enabled Peripheral: I2C
.i2cSlaveAddress = 0x10, // Use user-defined I2C address
.peripheralDetectionTimeoutMs = 3000, // Use user-defined timeout (ms)
.clockFlags = 0xFF, // Disable High speed mode
.clockDivider = 0xFF, // Use clock divider (0)
};
Without the "used" attribute, GCC removes the variable both for release and debug builds.
Cheers!
- Laci
Hi
Please refer the "5.8 Integrate config file to user project" of Kinetis Flash Tool User's Guide.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks Robin! I was aware of the Kinetis Flash tool, but I didn't know it can generate the BCA. In the meantime, I generated the BCA C file and adapted it to the KL03, and still, it doesn't work.
Please take a look at my BootloaderConfig variable and linker script.
The bootloader always times out after the default 5 seconds instead of the specified 1 second. It's like the bootloader ignores the BCA. Do you have any ideas why?
Thank you very much in advance!
- Laci
Sorry for the late reply!
Please check the srec(bin) file: if the BCA data is write into the srec file.
I test the led_output demo with KDS(C:\test\SDK_2.2_FRDM-KL03Z\boards\frdmkl03z\driver_examples\gpio\led_output\kds\...)
The LED will toggle after timeout(1000ms), Update the bin(srec)file by using KinetisFlashTool.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for the further help, Robin!
I checked the .bin file with KinetisFlashTool and it shows all zeros. I also checked the .srec file and it doesn't contain the 3c0 section further confirming that the BCA flash region is not mapped.
I really don't know what am I missing. According to the MKL03Z32xxx4_flash.ld and main.c files that I referenced above I think it should work, but it doesn't.
Please let me know if you have any further ideas.
Thank you for all your help!
- Laci
Hi Laci,
After add BootloaderConfig section in the startup_MKL03Z4.S file, you can see it in srec file.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your further help, Robin!
In the meantime, I've upgraded from KDS to MCUXpresso which uses startup_mkl03z4.c instead of startup_MKL03Z4.S so unfortunately your last suggestion is not relevant anymore.
I believe I should use the "used" GCC attribute because without it, GCC probably throws away the unreferenced bootloader configuration structure, but right now I cannot test it due to a linker script issue that I've just opened. I'd really appreciate if you could take a look at it. This issue blocks me until it's resolved.
Thank you!
- Laci
In the meantime, I've downgraded to KDS and I can confirm that the lack of the "used" attribute was the culprit. The following works:
__attribute__((used, section(".BootloaderConfig"))) const bootloader_config_t BootloaderConfig = {
.tag = 0x6766636B, // Magic Number
.enabledPeripherals = 0xE2, // Enabled Peripheral: I2C
.i2cSlaveAddress = 0x10, // Use user-defined I2C address
.peripheralDetectionTimeoutMs = 3000, // Use user-defined timeout (ms)
.clockFlags = 0xFF, // Disable High speed mode
.clockDivider = 0xFF, // Use clock divider (0)
};
Without the "used" attribute, GCC removes the variable both for release and debug builds.
Cheers!
- Laci