- Debugging on Milandr 32-bit Cortex-М MCU using GNU MCU Eclipse with the native SEGGER J-Link drivers.
- Internal EEPROM programming using GNU toolchain.
Supported microcontrollers: 1986BE9x (MDR32F9Qx), 1986BE1 (MDR32F1), 1986BE3.
Unfortunately, SEGGER is not aware of Milandr MCU 1986x series existence, so the native drivers do not contain the EEPROM programming algorithm for these microcontrollers. As a result, you are not able to use the native J-Flash utilities.
Moreover, you have to use OpenOCD instead of the native drivers for debugging with GNU MCU Eclipse. OpenOCD is quite good, but at present, it is slightly less functional, for example, OpenOCD debugging Eclipse plug-in does not support a capturing of Serial Wire Output (SWO).
The last problem is that you can use SEGGER Real Time Transfer (RTT) only with the native drivers.
- LOADER (RAMCode) implements the EEPROM programming algorithm.
- GDB script on Python – "JFlash.py" redefines the GDB
load
command.
Windows: Some GDB commands do not allow to quote filenames within ""
, so you can NOT use space characters
in J-Flash utilities installation path.
- How to program EEPROM using GNU toolchain
- How to debug using GNU MCU Eclipse
- How to check a program integrity in EEPROM at runtime
- Install SEGGER J-Link Software. The script was tested with JLink
5.10
..6.12
. - Install GNU toolchain. The script was tested with GCC
4.9-2015-q3
. - Install Python 2.7 (32 bit) and set PYTHONHOME and PYTHONPATH environment variables.
- You may need to add GNU toolchain path into PATH environment variable manually.
After that, you can run the following command to program EEPROM:
JFlash.bat <BIN_FILE>
First of all, this batch file starts the J-Link GDB server, and then the GDB client. The client executes
program_from_shell
function from "JFlash.py" script with the name of the raw binary file
as an argument, something like that:
start /B JLinkGDBServerCL -if swd -device "Cortex-M1" -endian little -speed 2000 -port 2331 -singlerun
arm-none-eabi-gdb-py --batch -x JFlash.py -ex "py program_from_shell('yourapp.bin')"
-
Install GNU MCU Eclipse.
-
Configure J-Link debugging Eclipse plug-in.
-
Into the debugger launch configuration
GDB SEGGER J-Link Debugging → Debugger
, you should:
- Set
"Cortex-M1"
or"Cortex-M3"
(depends on MCU) intoJ-Link GDB Server Setup → Device name
. - Replace
gdb
withgdb-py
inGDB Client Setup → Executable
. - Add
-x JFlash.py
intoGDB Client Setup → Other options
(you have to use the full path to the script).
- Into
GDB SEGGER J-Link Debugging → Startup
, you should selectLoad Symbols and Executable → Load Executable → Use file
, and add the name of the raw binary file. If you select an ELF file for loading, the script will try to convert it into the raw binary using "arm-none-eabi-objcopy" utility.
"JFlash.py" script redefines GDB load
command, so when Eclipse calls load
, the script runs instead.
The script creates "JFlash.log" in the folder of your current project, also LOADER prints a trace using RTT. To launch RTT client (terminal) you should uncomment its call in "JFlash.bat" file.
After programming, if the mapfile of our binary exists, "JFlash.py" will set the address of RTT structure, and you will be able to interact with the loaded binary using RTT client. There is an example of RTT usage into "mdr1986x_RTT" project.
"JFlash.py" script writes CRC-32 of the loaded binary file aligned(4)
right after the image in EEPROM,
it could be compared with CRC-32 calculated by your program.