# Test STM32F429I-DISCO (ST-Link v2) as JLink connected with SWD to an Ebyte E220-900T22S (powered by an HydraBus + UART 96008N1 bridge)
cmd
cd C:\msys64\home\bvern\openocd_cx32l003_algo_buspirate_windows\build\bin
C:
openocd.exe -f jlink_swd_host_target_cx32l003.cfg -c "gdb_memory_map disable" -d2
# Telnet for fast tests
cmd
telnet 127.0.0.1 4444

halt
cx32l003 TAB (to have all available commands)
flash probe 0
flash list
reg
arm disassemble 0x00000000 16
arm disassemble 0x00001a28 8
step
read_memory 0x00000000 8 1024

# with telnet program uart_print.elf
reset;halt
program uart_print.elf verify reset

# with telnet program E220-900T22SD_7259-11-23.axf
reset;halt
program E220-900T22SD_7259-11-23.axf verify reset

reset;halt
program E220-900T22SD_7259-11-23.bin verify reset


# program flash elf with openocd
openocd.exe -f jlink_swd_host_target_cx32l003.cfg -c "uart_print.elf verify reset exit" -d2


# openocd with arm-none-eabi-gdb
cmd
openocd.exe -f jlink_swd_host_target_cx32l003.cfg -c "gdb_memory_map enable" -c "gdb_flash_program enable" -d2

# https://www.lagerdata.com/articles/using-gdb-server-to-remotely-debug-your-firmware
cmd
cd D:\_proj\__Lab_Tools\LoRa_LoRaWAN\E220-900T22D_LLCC68_Teardown_Reverse\CX32L003_SDK_V1.4.2-20220725_MOD_BVE_EBYTE_E220_UART\E220-900T22D\llcc68\build
D:

arm-none-eabi-gdb llcc68.elf
target remote 127.0.0.1:3333
load
# Force Hardware CX32L003F8 MCU Reset
mon mww 0x40020018 0x55AA6699
mon halt
break loop_tests
bt
x /12i $pc

mon mww 0x40020018 0x55AA6699;halt;



# openocd 
cmd
cd C:\msys64\home\bvern\openocd_cx32l003_algo_buspirate_windows\build\bin
openocd.exe -f jlink_swd_host_target_cx32l003.cfg -c "gdb_memory_map disable" -d2

# openocd telnet
telnet 127.0.0.1 4444
halt
program D:/_proj/__Lab_Tools/LoRa_LoRaWAN/E220-900T22D_LLCC68_Teardown_Reverse/CX32L003_SDK_V1.4.2-20220725_MOD_BVE_EBYTE_E220_UART/E220-900T22D/llcc68_ping_pong/ECLIPSE/Debug/llcc68_ping_pong.elf verify
# Force Hardware CX32L003F8 MCU Reset
mww 0x40020018 0x55AA6699;sleep 100;reset halt
