From 0354a649746bb965e4b81cd3aa355f3b595184e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Mon, 17 Dec 2012 18:24:27 +0000 Subject: [PATCH] incorporated s19reader in build --- BaS_gcc/bas.lk.in | 1 + BaS_gcc/include/s19reader.h | 31 +++++++++++++++++++++++++++++++ BaS_gcc/sources/BaS.c | 5 +++++ BaS_gcc/sources/s19reader.c | 14 ++++++++------ 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 BaS_gcc/include/s19reader.h diff --git a/BaS_gcc/bas.lk.in b/BaS_gcc/bas.lk.in index ff567da..8230976 100644 --- a/BaS_gcc/bas.lk.in +++ b/BaS_gcc/bas.lk.in @@ -35,6 +35,7 @@ SECTIONS objs/mmc.o(.text) objs/ff.o(.text) objs/sd_card.o(.text) + objs/s19reader.o(.text) objs/bas_printf.o(.text) objs/printf_helper.o(.text) objs/cache.o(.text) diff --git a/BaS_gcc/include/s19reader.h b/BaS_gcc/include/s19reader.h new file mode 100644 index 0000000..4dd805b --- /dev/null +++ b/BaS_gcc/include/s19reader.h @@ -0,0 +1,31 @@ +/* + * bas_types.h + * + * Created on: 17.11.2012 + * Author: mfro + * + * This file is part of BaS_gcc. + * + * BaS_gcc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BaS_gcc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with BaS_gcc. If not, see . + * + * Copyright 2012 M. Froeschle + * + */ + +#ifndef _S19READER_H_ +#define _S19READER_H_ + +extern void flasher_load(char *flasher_filename); + +#endif /* _S19READER_H_ */ diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index 7365023..549156c 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -34,6 +34,9 @@ #include #include + +#include + /* imported routines */ extern int mmu_init(); extern int vec_init(); @@ -182,6 +185,8 @@ void BaS(void) sd_card_init(); + flasher_load("BASFLASH.S19"); + xprintf("copy EmuTOS: "); /* copy EMUTOS */ diff --git a/BaS_gcc/sources/s19reader.c b/BaS_gcc/sources/s19reader.c index 83d4d51..e73cc8a 100644 --- a/BaS_gcc/sources/s19reader.c +++ b/BaS_gcc/sources/s19reader.c @@ -28,6 +28,7 @@ #include #include #include +#include typedef enum { FALSE, TRUE } bool; typedef enum { OK, FAIL } err_t; @@ -65,10 +66,7 @@ uint8_t nibble_to_byte(uint8_t nibble) return 10 + nibble - 'A'; else if ((nibble >= 'a' && nibble <= 'f')) return 10 + nibble - 'a'; - else - { - /* FIXME: do a clean error exit */ - } + return 0; } uint8_t hex_to_byte(uint8_t hex[2]) @@ -229,7 +227,7 @@ err_t read_srecords(char *filename, uint32_t *start_address, uint32_t *actual_le return ret; } -void flasher_load(void) +void flasher_load(char *flasher_filename) { DRESULT res; FRESULT fres; @@ -250,7 +248,11 @@ void flasher_load(void) xprintf("mount status of SD card fs is %d\r\n", fres); if (fres == FR_OK) { - err = read_srecords("../BaS_gcc_trunk/ram.elf.s19", &start_address, &length, buffer, sizeof(buffer)); + err = read_srecords(flasher_filename, &start_address, &length, buffer, sizeof(buffer)); + if (err == OK) + { + + } } f_mount(0, NULL); }