fix basflash load address
This commit is contained in:
6
Makefile
6
Makefile
@@ -66,7 +66,7 @@ LDCFILE=bas.lk
|
|||||||
LDRFILE=ram.lk
|
LDRFILE=ram.lk
|
||||||
LDCSRC=bas.lk.in
|
LDCSRC=bas.lk.in
|
||||||
LDCBSRC=basflash.lk.in
|
LDCBSRC=basflash.lk.in
|
||||||
LDCBFS=bashflash.lk
|
LDCBFS=basflash.lk
|
||||||
|
|
||||||
# this Makefile can create the BaS to flash or an arbitrary ram address (for BDM debugging). See
|
# this Makefile can create the BaS to flash or an arbitrary ram address (for BDM debugging). See
|
||||||
# below for the definition of TARGET_ADDRESS
|
# below for the definition of TARGET_ADDRESS
|
||||||
@@ -315,9 +315,9 @@ endif
|
|||||||
$(1)_MAPFILE_BFL=$(1)/$$(basename $$(BASFLASH_EXEC)).map
|
$(1)_MAPFILE_BFL=$(1)/$$(basename $$(BASFLASH_EXEC)).map
|
||||||
$(1)/$$(BASFLASH_EXEC): $(1)/objs/basflash.o $(1)/objs/basflash_start.o $(1)/$(LIBBAS) $(LDCBFL)
|
$(1)/$$(BASFLASH_EXEC): $(1)/objs/basflash.o $(1)/objs/basflash_start.o $(1)/$(LIBBAS) $(LDCBFL)
|
||||||
@echo CPP $$<
|
@echo CPP $$<
|
||||||
@$(CPP) $(INCLUDE) -P -DOBJDIR=$(1)/objs -DFORMAT_ELF=$(FORMAT_ELF) -D$$(MACHINE) $(LDCBSRC) -o $(1)/$$(LDCBFS)
|
$(CPP) $(INCLUDE) -P -DOBJDIR=$(1)/objs -DFORMAT_ELF=$(FORMAT_ELF) -D$$(MACHINE) $(LDCBSRC) -o $(1)/$$(LDCBFS)
|
||||||
@echo CC $$<
|
@echo CC $$<
|
||||||
@$(CC) -nostdlib -Wl,--oformat -Wl,$$(FORMAT) -Wl,-Map -Wl,$$($(1)_MAPFILE_BFL) -Wl,--cref -Wl,-T -Wl,$(1)/$$(LDCFILE) -L$(1) -lbas $(LDLIBS) -o $$@
|
@$(CC) -nostdlib -Wl,--oformat -Wl,$$(FORMAT) -Wl,-Map -Wl,$$($(1)_MAPFILE_BFL) -Wl,--cref -Wl,-T -Wl,$(1)/$$(LDCBFS) -L$(1) -lbas $(LDLIBS) -o $$@
|
||||||
ifeq ($(COMPILE_ELF),Y)
|
ifeq ($(COMPILE_ELF),Y)
|
||||||
@echo OBJCOPY $$<
|
@echo OBJCOPY $$<
|
||||||
@$(OBJCOPY) -O srec $$@ $$(basename $$@).s19
|
@$(OBJCOPY) -O srec $$@ $$(basename $$@).s19
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
#ifdef MACHINE_FIREBEE
|
#if defined(MACHINE_FIREBEE)
|
||||||
#include "firebee.h"
|
#include "firebee.h"
|
||||||
#endif /* MACHINE_FIREBEE */
|
#elif defined(MACHINE_M5484LITE)
|
||||||
|
|
||||||
#ifdef MACHINE_M5484LITE
|
|
||||||
#include "m5484l.h"
|
#include "m5484l.h"
|
||||||
#endif /* MACHINE_M5484LITE */
|
#elif defined(MACHINE_M54455)
|
||||||
|
#include "m54455.h"
|
||||||
|
#else
|
||||||
|
#error unknown machine
|
||||||
|
#endif
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
flasher (WX) : ORIGIN = TARGET_ADDRESS, LENGTH = 0x00100000 /* target to load basflash */
|
flasher (WX) : ORIGIN = BFL_TARGET_ADDRESS, LENGTH = 0x00100000 /* target to load basflash */
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt
|
|||||||
|
|
||||||
if ((fres = f_open(&file, filename, FA_READ) == FR_OK))
|
if ((fres = f_open(&file, filename, FA_READ) == FR_OK))
|
||||||
{
|
{
|
||||||
uint8_t line[80];
|
uint8_t line[255];
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
int data_records = 0;
|
int data_records = 0;
|
||||||
bool found_block_header = false;
|
bool found_block_header = false;
|
||||||
@@ -259,6 +259,7 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt
|
|||||||
{
|
{
|
||||||
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
// xprintf("S7 record (end) found after %d valid data blocks\r\n", data_records);
|
||||||
*start_address = (void *) SREC_ADDR32(vector);
|
*start_address = (void *) SREC_ADDR32(vector);
|
||||||
|
xprintf("found start address %p\r\n", *start_address);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -333,7 +334,11 @@ static err_t verify(uint8_t *dst, uint8_t *src, size_t length)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (*src++ != *dst++)
|
if (*src++ != *dst++)
|
||||||
|
{
|
||||||
|
xprintf("data differs at %p (expected 0x%02x, got 0x%02x)\r\n",
|
||||||
|
*(src - 1), *(dst - 1));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
} while (src < end);
|
} while (src < end);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -342,7 +347,7 @@ static err_t verify(uint8_t *dst, uint8_t *src, size_t length)
|
|||||||
/*
|
/*
|
||||||
* needed to avoid missing type cast warning below
|
* needed to avoid missing type cast warning below
|
||||||
*/
|
*/
|
||||||
static inline err_t srec_memcpy(uint8_t *dst, uint8_t *src, size_t n)
|
err_t srec_memcpy(uint8_t *dst, uint8_t *src, size_t n)
|
||||||
{
|
{
|
||||||
err_t e = OK;
|
err_t e = OK;
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000)
|
#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000)
|
||||||
#else
|
#else
|
||||||
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
||||||
|
#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */
|
||||||
|
|
||||||
#endif /* COMPILE_RAM */
|
#endif /* COMPILE_RAM */
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#else
|
#else
|
||||||
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
||||||
#endif /* COMPILE_RAM */
|
#endif /* COMPILE_RAM */
|
||||||
|
#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */
|
||||||
|
|
||||||
#define DRIVER_MEM_BUFFER_SIZE 0x100000
|
#define DRIVER_MEM_BUFFER_SIZE 0x100000
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#else
|
#else
|
||||||
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
#define TARGET_ADDRESS BOOTFLASH_BASE_ADDRESS
|
||||||
#endif /* COMPILE_RAM */
|
#endif /* COMPILE_RAM */
|
||||||
|
#define BFL_TARGET_ADDRESS 0x0100000 /* load address for basflash */
|
||||||
|
|
||||||
#define DRIVER_MEM_BUFFER_SIZE 0x100000
|
#define DRIVER_MEM_BUFFER_SIZE 0x100000
|
||||||
|
|
||||||
|
|||||||
@@ -43,5 +43,6 @@ typedef err_t (*memcpy_callback_t)(uint8_t *dst, uint8_t *src, size_t length);
|
|||||||
|
|
||||||
extern void srec_execute(char *filename);
|
extern void srec_execute(char *filename);
|
||||||
extern err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback);
|
extern err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback);
|
||||||
|
extern err_t srec_memcpy(uint8_t *dst, uint8_t *src, size_t n);
|
||||||
|
|
||||||
#endif /* _S19READER_H_ */
|
#endif /* _S19READER_H_ */
|
||||||
|
|||||||
@@ -378,8 +378,3 @@ static err_t verify(uint8_t *dst, uint8_t *src, uint32_t length)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void srec_execute(char *flasher_filename)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user