fixed Makefile, fixed dependencies and removed doubly defined symbols

This commit is contained in:
Markus Fröschle
2013-02-04 10:38:11 +00:00
parent 69f147e9cf
commit 67ede2fddb
6 changed files with 33 additions and 34 deletions

View File

@@ -62,7 +62,7 @@
<option id="cdt.managedbuild.option.gnu.cross.prefix.129963777" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
<option id="cdt.managedbuild.option.gnu.cross.path.176129148" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
<targetPlatform archList="all" binaryParser="" id="cdt.managedbuild.targetPlatform.gnu.cross.2042576934" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/BaS_GNU}" cleanBuildTarget="clean" command="make" enableAutoBuild="true" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.1808605670" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="unlimited" superClass="cdt.managedbuild.builder.gnu.cross">
<builder arguments="-j4" autoBuildTarget="all" buildPath="${workspace_loc:/BaS_GNU}" cleanBuildTarget="clean" command="make" enableAutoBuild="false" enableCleanBuild="true" enabledIncrementalBuild="true" id="cdt.managedbuild.builder.gnu.cross.1808605670" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.builder.gnu.cross">
<outputEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name=""/>
</outputEntries>
@@ -90,8 +90,8 @@
</tool>
</toolChain>
</folderInfo>
<fileInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.Makefile" name="Makefile" rcbsApplicability="disable" resourcePath="Makefile" toolsToInvoke=""/>
<fileInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.149483996" name="bas_printf.h" rcbsApplicability="disable" resourcePath="include/bas_printf.h" toolsToInvoke=""/>
<fileInfo id="cdt.managedbuild.toolchain.gnu.cross.base.500844171.756690686.Makefile" name="Makefile" rcbsApplicability="disable" resourcePath="Makefile" toolsToInvoke=""/>
<sourceEntries>
<entry excluding="include|sources" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="sources"/>

View File

@@ -7,6 +7,7 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>

View File

@@ -96,7 +96,7 @@ lib: $(LIBBAS)
@ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19 \
$(RAM_EXEC) $(RAM_EXEC).elf $(RAM_EXEC).s19 \
$(BASFLASH_EXEC) $(BASFLASH_EXEC).elf $(BASFLASH_EXEC).s19 \
$(OBJS) $(MAPFILE) $(LDCFILE) depend
$(OBJS) $(OBJDIR)/basflash.o $(MAPFILE) $(LDCFILE) $(LIBBAS) $(LDCBFS) depend
$(FLASH_EXEC): TARGET_ADDRESS=0xe0000000
$(RAM_EXEC): TARGET_ADDRESS=0x10000000
@@ -112,8 +112,7 @@ else
endif
# the basflash (SD-card executable called from BaS) final link stage
$(BASFLASH_EXEC): $(OBJS) $(LDCBFL)
$(CC) $(CFLAGS) $(INCLUDE) -c $(SRCDIR)/basflash.c -o $(OBJDIR)/basflash.o
$(BASFLASH_EXEC): $(OBJDIR)/basflash.o $(LIBBAS) $(LDCBFL)
$(CPP) -P -DTARGET_ADDRESS=$(BF_TARGET_ADDRESS) -DFORMAT=$(FORMAT) $(LDCBSRC) -o $(LDCBFS)
$(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCBFS) -L. -lbas -o $@
ifeq ($(COMPILE_ELF),Y)

View File

@@ -26,6 +26,21 @@
#ifndef _S19READER_H_
#define _S19READER_H_
typedef enum
{
OK, /* no error */
FAIL, /* general error aka "I don't know what went wrong" */
FILE_OPEN, /* file open failed */
FILE_READ, /* file read failed */
SREC_CORRUPT, /* file doesn't seem to contain valid S-records */
MEMCPY_FAILED, /* could not copy buffer to destination */
CODE_OVERLAPS, /* copying would overwrite ourself */
VERIFY_FAILED /* destination does not read as we've written to */
} err_t;
typedef err_t (*memcpy_callback_t)(uint8_t *dst, uint8_t *src, uint32_t length);
extern void srec_execute(char *filename);
extern err_t read_srecords(char *filename, void **start_address, uint32_t *actual_length, memcpy_callback_t callback);
#endif /* _S19READER_H_ */

View File

@@ -12,8 +12,6 @@
#include <ff.h>
#include <s19reader.h>
typedef enum {OK, ERR} err_t;
uint32_t mx29lv640d_sector_groups[] =
{
0xe0000000, 0xe0008000, 0xe0010000, 0xe0018000, 0xe0020000, 0xe0028000, 0xe0030000, 0xe0038000,
@@ -79,7 +77,7 @@ void srec_flash(char *flash_filename)
if (err == OK)
{
xprintf("OK.\r\nerase flash area (from %p): ", start_address);
err = erase(start_address);
err = erase_flash_region(start_address);
/* next pass: copy data to destination */
xprintf("OK.\r\flash data: ");

View File

@@ -24,26 +24,14 @@
*/
#include <stdint.h>
#include <bas_printf.h>
#include <sd_card.h>
#include <diskio.h>
#include <ff.h>
#include <s19reader.h>
#include <stdbool.h>
#include <stdlib.h>
typedef enum { FALSE, TRUE } bool;
typedef enum
{
OK, /* no error */
FAIL, /* general error aka "I don't know what went wrong" */
FILE_OPEN, /* file open failed */
FILE_READ, /* file read failed */
SREC_CORRUPT, /* file doesn't seem to contain valid S-records */
MEMCPY_FAILED, /* could not copy buffer to destination */
CODE_OVERLAPS, /* copying would overwrite ourself */
VERIFY_FAILED /* destination does not read as we've written to */
} err_t;
#define NULL (void *) 0L
#include "bas_printf.h"
#include "sd_card.h"
#include "diskio.h"
#include "ff.h"
#include "s19reader.h"
/*
* Yes, I know. The following doesn't really look like code should look like...
@@ -155,7 +143,7 @@ void print_record(uint8_t *arr)
/*
* convert an S-record line into its corresponding byte vector (ASCII->binary)
*/
void line_to_vector(uint8_t *line, uint8_t *vector)
static void line_to_vector(uint8_t *line, uint8_t *vector)
{
int i;
int length;
@@ -174,8 +162,6 @@ void line_to_vector(uint8_t *line, uint8_t *vector)
}
}
typedef err_t (*memcpy_callback_t)(uint8_t *dst, uint8_t *src, uint32_t length);
/*
* read and parse a Motorola S-record file and copy contents to dst. The theory of operation is to read and parse the S-record file
* and to use the supplied callback routine to copy the buffer to the destination once the S-record line is converted.
@@ -206,9 +192,9 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt
uint8_t line[80];
int lineno = 0;
int data_records = 0;
bool found_block_header = FALSE;
bool found_block_end = FALSE;
bool found_block_data = FALSE;
bool found_block_header = false;
bool found_block_end = false;
bool found_block_data = false;
while (ret == OK && (uint8_t *) f_gets((char *) line, sizeof(line), &file) != NULL)
{
@@ -229,7 +215,7 @@ err_t read_srecords(char *filename, void **start_address, uint32_t *actual_lengt
switch (vector[0])
{
case 0: /* block header */
found_block_header = TRUE;
found_block_header = true;
if (found_block_data || found_block_end)
{
xprintf("S7 or S3 record found before S0: S-records corrupt?\r\n");