HowTo: flash Artery AT32F435 and AT32F437

It's all about the code!
Post Reply
User avatar
Dron_Gus
contributor
contributor
Posts: 456
Joined: Wed Nov 13, 2013 1:11 pm
Location: S-Pb
Github Username: dron0gus

HowTo: flash Artery AT32F435 and AT32F437

Post by Dron_Gus »

These Artery chips are used in some OEM ECU in Russia.
See https://rusefi.com/forum/viewtopic.php?f=4&t=2497&p=47759
We are going to run full-featured RE on this ECU someday.
Today Andrey has merged AT-START-F435 (F437) support in master.

To flash this demo board in Linux environment using on-board debugger you will need patched OpenOCD (https://github.com/dron0gus/openocd/tree/artery-dev)
Thanks to Pilatomic for initial Artery support.
Build and install:

Code: Select all

git clone git@github.com:dron0gus/openocd.git
cd openocd
git checkout artery-dev
git submodule --init --recursive
./bootstrap
./configure
# make sure CMSIS-DAP is enabled
make -j
sudo make install
Download at32f4x.cfg file: https://github.com/rusefi/ChibiOS/blob/stable_20.3.x.rusefi_clean_history/demos/STM32/RT-AT32F435-ARTERY144/at32f4x.cfg
Run

Code: Select all

openocd -f interface/cmsis-dap.cfg -f ./at32f4x.cfg -c '$_TARGETNAME configure -rtos auto' $*
Make sure mcu is detected:

Code: Select all

Info : [at32f4x.cpu] Cortex-M4 r0p1 processor detected
Info : [at32f4x.cpu] target has 6 breakpoints, 4 watchpoints
I assume you were able to build RusEFI FW for this board by running following command in rusefi/firmware directory

Code: Select all

(cd ./config/boards/at_start_f435 ; ./compile_at_start_f435.sh)
Now start lets GDB

Code: Select all

arm-none-eabi-gdb
And execute

Code: Select all

target extended-remote localhost:3333
file build/rusefi.elf
load
After loading is finished: 'r', enter, 'y'.
Congrats you are true hacker!

To skip entering same commands on every gdb run you can create .gdbinit file in you working directory with following content:

Code: Select all

target extended-remote localhost:3333
file build/rusefi.elf
load
set breakpoint auto-hw on
set remote hardware-breakpoint-limit 8
set remote hardware-watchpoint-limit 4
User avatar
AndreyB
Site Admin
Posts: 14334
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: HowTo: flash Artery AT32F435 and AT32F437

Post by AndreyB »

Improved set of scripts is now at https://github.com/rusefi/m74.9/tree/main/firmware/rusEFI

I've used https://www.segger.com/products/debug-probes/j-link/models/j-link-edu-mini/

Funny thing somehow it's $42 on eBay and I am positive that it was drop shipped from mouser (or was it digikey?) while it's $60 plus shipping on mouser. First time funny pricing like that!

Code: Select all

Info : [at32f4x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for at32f4x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Warn : [at32f4x.cpu] target was in unknown state when halt was requested
Info : Chip: AT32F435ZMT7, 4032kB FLASH, 4096 bytes sectors
Info : Bank 1: 2048kB
flash 'artery' found at 0x08000000
auto erase enabled
wrote 475136 bytes from file rusefi.snapshot.m74_9/rusefi.bin in 82.683136s (5.612 KiB/s)
Error: error executing cortex_m crc algorithm
verified 471348 bytes from file rusefi.snapshot.m74_9/rusefi.bin in 6.095647s (75.513 KiB/s)
I have an m74.9 OEM ECU posting rusEFI meta info into the CANbus!
image.png
image.png (42.89 KiB) Viewed 31653 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
Post Reply