0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xbus converterにfirmwareを書き込む

Last updated at Posted at 2020-11-18

xbus converterにfirmwareを書き込む。

まずは、以下のサイトを参考にNucleo経由でopenOCDでSTM32F446REを接続できるか試す。

とりあえず、nucleo-64経由でSTM34F446REに接続はできた。

次は、LPC812と接続する。

/usr/shre/openocd/script/targetのlpc812.cfgとlpc8xx.cfgを探すのに一苦労。
ここがとても参考になった、https://gist.github.com/RickKimball/9009480
/home/miyamoto/git/openocd/tcl/targetのlpc8xx.cfgを使って成功。
Nucleoを使う場合は、 -f -f interface/stlink-v2-1.cfgを指定する。

LPCのデータシート http://www.keil.com/dd/docs/datashts/nxp/lpc8xx/lpc81xm.pdf
配線はここ https://www.sevenwatt.com/main/picos-arm/picos-arm-lpc810-swd-jtag-with-nucleo-stm32/

$openocd -f interface/stlink-v2-1.cfg -f target/lpc812.cfg
 Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)
 Licensed under GNU GPL v2
 For bug reports, read
     http://openocd.org/doc/doxygen/bugs.html
 Info : auto-selecting first available session transport "hla_swd". To override 
 use 'transport select <transport>'.
 Info : The selected transport took over low-level target control. The results 
 might differ compared to plain JTAG/SWD
 adapter speed: 10 kHz
 adapter_nsrst_delay: 200
 Info : Unable to match requested speed 10 kHz, using 5 kHz
 Info : Unable to match requested speed 10 kHz, using 5 kHz
 Info : clock speed 5 kHz
 Info : STLINK v2 JTAG v28 API v2 SWIM v17 VID 0x0483 PID 0x374B
 Info : using stlink api v2
 Info : Target voltage: 3.251613
 Info : lpc812.cpu: hardware has 4 breakpoints, 2 watchpoints

$telent localhost 4444
>reset halt
>flash write_image erase /home/miyamoto/git/rcinput-converter/build/rcconv.elf
 auto erase enabled
 target state: halted
 target halted due to breakpoint, current mode: Thread 
 xPSR: 0x61000000 pc: 0x10000004 msp: 0x10000104
 Verification will fail since checksum in image (0x0000030d) to be written to 
 flash is different from calculated vector checksum (0xefffe9be).
 To remove this warning modify build tools on developer PC to inject correct LPC vector checksum. 
 wrote 3072 bytes from file /home/miyamoto/git/rcinput-
 converter/build/rcconv.elf in 79.712662s (0.038 KiB/s)

チェックサムが違うっていわれたが、とりあえず書き込みはできた。

openOCDのメッセージ

Info : accepting 'telnet' connection on tcp/4444
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x1fff0008 msp: 0x10000ffc
auto erase enabled 
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x10000004 msp: 0x10000104
Warn : Verification will fail since checksum in image (0x0000030d) to be written to flash is different from calculated vector checksum (0xefffe9be).
Warn : To remove this warning modify build tools on developer PC to inject 
correct LPC vector checksum.
wrote 3072 bytes from file /home/miyamoto/git/rcinput-
converter/build/rcconv.elf in 79.712662s (0.038 KiB/s)
Info : dropped 'telnet' connection

wiring.jpg

conperter.jpg

Nucleo.jpg

checksum errorの原因を調べる

Warn : Verification will fail since checksum in image (0x0000030d) to be written to flash is 
different from calculated vector checksum (0xefffe9be).
Warn : To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.

以下ここからの引用 https://forum.sparkfun.com/viewtopic.php?t=16417

どうやら無視して良いようだ。

gnore that.

The 6th interrupt vector for LPC2000 holds a checksum that validates user code. This checksum is 
injected by OpenOCD, not the compiler, so genrally the image you'd download from the core would be 
different than the one you had from the compiler.
 
---------------------------------------------------------------------------------------------------

Yes i know that, but this checksum must be a valid checksum or my programm doesn´t work. It´s weird 
because the prgram works fine.

So i ignore that for now but why OpenOCD change this checksum?
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?