TODO list

This commit is contained in:
rebane 2016-08-22 14:44:25 +03:00
parent 2b07e47fb8
commit bac8307df0
5 changed files with 20 additions and 18 deletions

View file

@ -1,15 +1,15 @@
FIRMWARE_ADDRESS = 0x10001000
BUFFER = 0x10008000
BUFFER_ADDRESS = 0x10008000
BUFFER_SIZE = 262144
FLASH_SECTOR_SIZE = 4096
all:
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=$(BUFFER) rtl8710_flasher.c spi_flash.c -o rtl8710_flasher.elf
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
arm-none-eabi-objcopy -O binary rtl8710_flasher.elf rtl8710_flasher.bin
gcc make_array.c -o make_array
cp rtl8710_cpu.ocd rtl8710.ocd
echo "set rtl8710_flasher_firmware_ptr $(FIRMWARE_ADDRESS)" >>rtl8710.ocd
echo "set rtl8710_flasher_buffer $(BUFFER)" >>rtl8710.ocd
echo "set rtl8710_flasher_buffer $(BUFFER_ADDRESS)" >>rtl8710.ocd
echo "set rtl8710_flasher_buffer_size $(BUFFER_SIZE)" >>rtl8710.ocd
echo >>rtl8710.ocd
echo "array set rtl8710_flasher_code {" >>rtl8710.ocd

View file

@ -26,8 +26,8 @@ compare file (filename) with flash offset (offset)
### rtl8710_flash_auto_erase [1/0]
set auto_erase option on/off. flash pages will be autoerased when writing
### rtl8710_flash_auto_verify [1/0]
set auto_verify on/off. each block of data will be auto verified when writing
## example:
set auto_verify option on/off. each block of data will be auto verified when writing
## examples:
```
openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read dump.bin 0 1048576" -c "shutdown"
```

5
TODO.txt Normal file
View file

@ -0,0 +1,5 @@
TESTING
better documentation
error handling
timeout handling

View file

@ -4,22 +4,19 @@
int main(){
ssize_t i, l;
uint32_t value;
uint32_t value, index;
uint8_t buffer[24];
int started, index;
started = index = 0;
index = 0;
while(1){
l = read(0, buffer, 24);
if(l < 1)break;
if(started)printf("\n");
started = 1;
printf("\t");
for(i = 0; i < l; i += 4){
value = ((uint32_t)buffer[i + 0] << 0) | ((uint32_t)buffer[i + 1] << 8) | ((uint32_t)buffer[i + 2] << 16) | ((uint32_t)buffer[i + 3] << 24);
if(i)printf(" ");
printf("%d 0x%08X", index++, (unsigned int)value);
}
printf("\n");
}
printf("\n");
}

View file

@ -2,13 +2,13 @@
#include <stdio.h>
#include "spi_flash.h"
#define MEM_START (*(volatile uint32_t *)(BUFFER + 0x00))
#define MEM_COMMAND (*(volatile uint32_t *)(BUFFER + 0x04))
#define MEM_STATUS (*(volatile uint32_t *)(BUFFER + 0x08))
#define MEM_PARAM (*(volatile uint32_t *)(BUFFER + 0x0C))
#define MEM_OFFSET (*(volatile uint32_t *)(BUFFER + 0x10))
#define MEM_LEN (*(volatile uint32_t *)(BUFFER + 0x14))
#define MEM_DATA ((volatile uint8_t *)(BUFFER + 0x20))
#define MEM_START (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x00))
#define MEM_COMMAND (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x04))
#define MEM_STATUS (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x08))
#define MEM_PARAM (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x0C))
#define MEM_OFFSET (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x10))
#define MEM_LEN (*(volatile uint32_t *)(BUFFER_ADDRESS + 0x14))
#define MEM_DATA ((volatile uint8_t *)(BUFFER_ADDRESS + 0x20))
#define COMMAND_READ_ID 0
#define COMMAND_MASS_ERASE 1