Microchip-MPLAB-Harmony / bootloader

Harmony 3 Bootloader
https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=MH3_bootloader&redirect=true
Other
23 stars 13 forks source link

Harmony bootloader on SAME70 - no UART communication, debug not working #23

Open Thugmek opened 1 year ago

Thugmek commented 1 year ago

I'm experiencing difficulties with Harmony bootloader on SAME70N20B chip. I want to build simple bootloader to be able to flash firmware via UART4. I have downloaded MPLAB X IDE, made new project and via MCC Content Manager Wizard added some harmony packages. I'm not sure, what exact packeges it was, I'm not able to open the same window now, MCC button opens Project Graph now, but It was something related with ATSAME70, UART and some core Harmony package. Project graph window appeared with nodes EFC, Device Family Pack, System and CMSIS Pack. I have added UART Bootloader and UART4 and connected them to each other. I have also find Pin Settings window, where I have asigned PD18 and PD19 to UART4. Clock settings should be OK by default, I have checked it. Then I have clicked Generate button. Lot of C files appeared in my project, with all the firmware update logic. I have override bootloader trigger, so it should always proceed to bootloader, not to firmware itself (temporary solution, I want to implement here some logic later). I have built it and flash it to the board via Atmel-ICE debugger. But when I try to flash program via UART with provided python tool, there is no communication from board to computer (from computer to board is). I have tried to debug generate code with Atmel-ICE debugger, but when I lay breakpoint, it says Broken Breakpoint. There is some code running on board, I can read Execution Memory and view disassembled code. There are some labels, like bootloader_UART_Tasks or main, which indicates me, that there is some code builded and flashed an some linker debug files are present. I have found, that debugging works in startup_xc32.c file, which contains reset handler. Code stepping works here just fine. There must be something wrong with build process, because debugging breaks when code jumps out this file. I'm very confused by this. I have also found, that when I remove UART Bootloader and UART4 nodes in Project graph, there are way more generated code and debug works as fine in all files. When I make blank project with some basic led blinking code, I can debug it as fine. I can lay breakpoints, I can step trough code, standard debugging operations... I'm not familiar with MPLAB IDE, It's not exactly user friendly (It tries to be, which make things way way worse...). I have quite a few experiences wit C and C++ embedded programming and debugging in eclipse, this should be similar, but I'm something missing here. Maybe there is some bug, I'm don't know. I'm using latest version of all components. B.R. Michal

amitraddi commented 1 year ago
Thugmek commented 1 year ago

I have tried to do everything as mentioned in provided link. I have enabled software brekapoints, made breakpoint inside startup_x32.c, started dubugging session, then tried to do make breakpoint inside main.c. It still says "broken breakpoint". Here is my project as attachment. I don't know, what I'm doing wrong. test.zip