rtl8710-openocd/Makefile

41 lines
2 KiB
Makefile
Raw Normal View History

2016-08-22 08:22:31 +00:00
FIRMWARE_ADDRESS = 0x10001000
2016-08-22 11:44:25 +00:00
BUFFER_ADDRESS = 0x10008000
2016-08-22 08:22:31 +00:00
BUFFER_SIZE = 262144
FLASH_SECTOR_SIZE = 4096
all:
2016-08-22 11:44:25 +00:00
arm-none-eabi-gcc -Wall -g -Os -mlittle-endian -mlong-calls -mthumb -mcpu=cortex-m3 -mfloat-abi=soft -mthumb-interwork -ffunction-sections -ffreestanding -fsingle-precision-constant -Wstrict-aliasing=0 -Wl,-T,rtl8710.ld -nostartfiles -nostdlib -u main -Wl,--section-start=.text=$(FIRMWARE_ADDRESS) -DBUFFER_ADDRESS=$(BUFFER_ADDRESS) rtl8710_flasher.c spi_flash.c -o rtl8710_flasher.elf
2016-08-22 08:22:31 +00:00
arm-none-eabi-objcopy -O binary rtl8710_flasher.elf rtl8710_flasher.bin
gcc make_array.c -o make_array
2016-08-22 14:37:32 +00:00
cp rtl8710_cpu.tcl rtl8710.ocd
2016-08-22 08:22:31 +00:00
echo "set rtl8710_flasher_firmware_ptr $(FIRMWARE_ADDRESS)" >>rtl8710.ocd
2016-08-22 11:44:25 +00:00
echo "set rtl8710_flasher_buffer $(BUFFER_ADDRESS)" >>rtl8710.ocd
2016-08-22 08:22:31 +00:00
echo "set rtl8710_flasher_buffer_size $(BUFFER_SIZE)" >>rtl8710.ocd
2016-08-22 14:37:32 +00:00
echo "set rtl8710_flasher_sector_size $(FLASH_SECTOR_SIZE)" >>rtl8710.ocd
2016-08-22 08:22:31 +00:00
echo >>rtl8710.ocd
echo "array set rtl8710_flasher_code {" >>rtl8710.ocd
./make_array <rtl8710_flasher.bin >>rtl8710.ocd
echo "}" >>rtl8710.ocd
echo >>rtl8710.ocd
2016-08-22 14:37:32 +00:00
cat rtl8710_flasher.tcl >>rtl8710.ocd
2016-08-22 11:04:50 +00:00
cp rtl8710.ocd script/rtl8710.ocd
2016-08-22 08:22:31 +00:00
clean:
rm -rf rtl8710_flasher.elf rtl8710_flasher.bin make_array rtl8710.ocd
test:
2016-08-22 14:46:03 +00:00
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "shutdown"
2016-08-22 08:22:31 +00:00
2016-08-22 14:37:32 +00:00
dump:
2016-08-22 14:46:03 +00:00
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read dump.bin 0 1048576" -c "shutdown"
2016-08-22 14:37:32 +00:00
restore:
2016-08-22 18:16:15 +00:00
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write dump.bin 0" -c shutdown
2016-08-22 14:46:03 +00:00
verify:
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_verify dump.bin 0" -c shutdown
2016-08-22 14:37:32 +00:00
reset:
2016-08-22 14:46:03 +00:00
openocd -f interface/stlink-v2-1.cfg -f script/rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_reboot" -c shutdown
2016-08-22 14:37:32 +00:00