CubeIDE Execute command before debug
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-26 8:09 AM
Hi,
i would like to execute command after i click the debug icon, but before the debug starts.
In particular:
- I have an app with a bootloader. The bootloader check the CRC of the firmware before start it.
- Right now i generate, thanks to post build operation, a binary file with header, firmware and footer, a complete binary.
- I have disable the Download in the Debug configuration, so the debugger does not flash the firmware.
- I need a point where place the command for flashing the complete firmware with the header and the footer. This point should be before the debug session start, and after i click the debug icon.
Do you think it is possible? How can i do that?
Thank you in advance
- Labels:
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-26 10:06 AM
Instead of post/pre build commands use CDT files makefile.init, makefile.defs and makefile.targets. For CRC you may add target to /makefile.targets (file must be created!):
CRC_Tool := 'C:\Tools\crc.exe'
crc: all
-@echo 'Calculating CRC'
$(CRC_Tool) $(wildcard *.bin)
Press Shift-F9, add target crc, execute crc
To debug application, you don't need a bootloader, CubeIDE will start application from ld flash address, but you have to add code to move the stack as first lines to main:
#define FLASH_START 0x800....
....
int main()
{
/* USER CODE BEGIN 1 */
__disable_irq();
SCB->VTOR = FLASH_START | VECT_TAB_OFFSET;
__DSB();
__enable_irq();
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-29 3:46 AM
Hi, thanks for the answer.
It is not clear how i can create a CRC based on the binary file before i create that binary file. Are you sure is it possible with CDT files?
Regarding the debug: it is clear that if i launch debug from the IDE the debug and the application work. But if i reboot the board, the bootloader does not recognize the CRC of the application, and it won't start anymore.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-10-29 4:08 PM
crc: all
command(s)
This means:
- build "all" target first if something changed
- Run crc command(s)
