Martin
The project can be built in Visual Studio: https://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis.pdf
( here is the serial loader for Kboot HID AES256 being build in VS: https://www.youtube.com/watch?v=MXsJvTdCcH4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=25 )
and when it runs in VS it simulates the Kinetis (or i.MX RT) part.
It uses a post-build step to also generate an object (using GCC) that can be loaded to the HW.
For HW debugging the project can be used in KDS, MCUXpressor, IAR, uVision, Crossworks, CooCox, etc.
I haven't yet tried VisualGDB but I expect that it will allow direct HW debugging in VS too if you have it.
I fact I am surprised that you use VisualGDB because, although I have always thought that it is a game changer, it seems to be poo-pooed by the majority of engineers due to the fact that they prefer a Linux/Mac cross-platform solution that has no links to Microsoft. But I am very pleased to hear that you are actually using it!
To build the serial loader in VS one opens the VS project located at
\Applications\uTaskerSerialBoot\Simulator\uTaskerSerialBoot.vcxproj
Please send me your email so I can send you account details to the professional version since the open source one doesn't include all security stuff. You can have a free commercial license if support remains at this forum.
The video (above) explains how to configure. For your board it is essentially (all in config.h):
#define FRDM_KL27Z (the board/processor - almost any part can be chosen without needing any other changes - parts with crypto accelerators will automatically use them)
#define USB_INTERFACE
#define HID_LOADER
#define KBOOT_HID_LOADER
#define KBOOT_SECURE_LOADER
- optionally set #define USB_MSD_DEVICE_LOADER and USB_MSD_DEVICE_SECURE_LOADER for KBOOT / USB-MSD composite
- optionally set #define SERIAL_INTERFACE and #define KBOOT_LOADER if you want secure Kboot also on a UART
Choose your decrypt keys (strings) in
serial_loader.c
at
static const CHAR decrypt_key[] = "aes256 secret key";
and
static const CHAR initial_vector[] = "initial vector";
and match these with the ones used to encrypt the application's binary file.
You will see that secure loading involves just two changes:
1.
Call to
fnPrepareDecrypt(0); // prepare AES-256 decryption key and initial vector
when KBOOT_COMMAND_TAG_ERASE_REGION is received (to delete space for the code)
2.
Decryped flash programmer
fnWriteBytesSecure(ptrFlashAddress, ptrKBOOT_packet->ucData, usBuff_length);
instead of
fnWriteBytesFlash(ptrFlashAddress, ptrKBOOT_packet->ucData, usBuff_length); // program flash
each time data is received with KBOOT_REPORT_ID_DATA_OUT
To build with GCC as post-build step choose the appropriate VS target (with the GCC step) and ensure you have set up the make file for your processor as described here: https://www.utasker.com/kinetis/compilers.html#GCC
If you need to change KBOOT handling you can find this in
extern int fnHandleKboot(QUEUE_HANDLE hInterface, int iInterfaceType, KBOOT_PACKET *ptrKBOOT_packet)
in serial_loader.c (valid for UART and HID)
Good luck
Regards
Mark
P.S. If building with the post build make/file step, make sure that you put this version of make.exe into the GCC binary directory:
https://www.utasker.com/forum/index.php?topic=1988.msg7410#msg7410