incorporated s19reader in build

This commit is contained in:
Markus Fröschle
2012-12-17 18:24:27 +00:00
parent 412b8e3d2d
commit 0354a64974
4 changed files with 45 additions and 6 deletions

View File

@@ -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)

View File

@@ -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 <http://www.gnu.org/licenses/>.
*
* Copyright 2012 M. Froeschle
*
*/
#ifndef _S19READER_H_
#define _S19READER_H_
extern void flasher_load(char *flasher_filename);
#endif /* _S19READER_H_ */

View File

@@ -34,6 +34,9 @@
#include <diskio.h>
#include <ff.h>
#include <s19reader.h>
/* 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 */

View File

@@ -28,6 +28,7 @@
#include <sd_card.h>
#include <diskio.h>
#include <ff.h>
#include <s19reader.h>
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);
}