Thanks for your reply @maxgerhardt ! Lots of useful tips and info
Regarding the different topics:
-
Virtual COM driver: Havenât tried yet as I want to get debugging running first, but will try it. Thought that maybe I was also missing some build param (such as
PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
or something like that)
-
Optimization: I was missing
-ggdb3
but Iâve realizaed that my issue was not even the lack of debug symbols but that I never actually run the main functionâŚ
-
Power supply: Is stable, yes⌠but maybe my wiring/soldering is a bit wonky. Revisited it and stability seems to have improved.
-
NRST pin: Still connecting from chip to STLink, but set
reset_config
to reset_config srst_only srst_nogate
on the file (for this board, st_nucleo_f0.cfg
). That seems to also have improved stability and now uploads seem to work. Aditionally, Iâve replaced source [find interface/stlink.cfg]
with source [find interface/stlink-v2.cfg]
My current issue is that firmware doesnât run, as in⌠the default breakpoint on main
is never reached (nor any other breakpoint I add). Using the debugger commands, Iâm trying to find out whatâs happening so I manually restart the board
> interrupt
> monitor reset halt
xPSR: 0xc1000000 pc: 0x00010100 msp: 0x464c457c
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x00010100 msp: 0x464c457c
{"token":58,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
and then step, showing me that I end up in some âdead endâ before even reaching the main
function.
> nexti
halted: PC: 0x00010102
> nexti
halted: PC: 0x00010104
> nexti
halted: PC: 0x0000d1b4
> nexti
halted: PC: 0x00000000
> nexti
halted: PC: 0xfffffffe
Itâs like Iâm hitting an exception or starting from the wrong PC. Any hints about what I could be doing wrong?
EDIT ok, think I was writing Marlin to 0x80000000 and destroying the booloaderâs vector table and such. Iâve set the build
section of buildroot/share/PlatformIO/boards/malyanM200v2.json
inside Marlinâs directory with content from ~/.platformio/platforms/ststm32/boards/malyanm200_f070b.json
"build": {
"cpu": "cortex-m0",
"extra_flags": "-DSTM32F070xB",
"framework_extra_flags": {
"arduino": "-DVECT_TAB_OFFSET=0x2000 -DCUSTOM_STARTUP_FILE"
},
"f_cpu": "48000000L",
"mcu": "stm32f070rbt6",
"genericvariant" : "MALYANM200_F070CB",
"variant": "MALYANM200_F070CB",
"vec_tab_addr": "0x8002000"
},
Now after reseting I get to
xPSR: 0xc1000000 pc: 0x08000198 msp: 0x20004000
That seems a more reasonable PC. Still, I never reach main
. If I step instruction by instruction, there seems to be a loop (probably a normal one) on the bootloader. If I let it continue
and then interrupt
, I still end up at 0xfffffffe
After this, Iâm kind of lost again