mbed LPC1114 emulator pre-alpha version

Dependencies:   BaseV6M mbed F12RFileSystem F32RFileSystem ROMSLOT SDStorage

Fork of emu812 by Norimasa Okamoto

480
TOYOSHIKI TINY BASIC mbed Edition TTB_mbed_LPC1114.bin save as "LPC1114.IMG" .

main.cpp

Committer:
va009039
Date:
2015-08-10
Revision:
0:e38daa7b1a22
Child:
1:913dfd59e25a

File content as of revision 0:e38daa7b1a22:

#include "mbed.h"
LocalFileSystem local("local");

DigitalOut led1(LED1);
RawSerial pc(USBTX,USBRX);

uint8_t flash[1024*16] __attribute__((section("AHBSRAM0")));
uint8_t rom[1024*8] __attribute__((section("AHBSRAM1")));

int load(uint8_t* buf, int size, const char* filename) {
    pc.printf("loading[%s]... ", filename);
    FileHandle* fh = local.open(filename, O_RDONLY);
    if (fh == NULL) { return -1; }
    int n = fh->read(buf, size);
    fh->close();
    pc.printf("%d bytes\n", n);
    return n;
}
   
int main() {
    pc.baud(115200);
    pc.printf("%s\n", __FILE__);
    
    if (load(flash, sizeof(flash), "LPC812.IMG") >= 0) {
        load(rom, sizeof(rom), "LPC812.ROM");    
    }
    
    while(1) {
        led1 = !led1;
        wait_ms(200);
    }
}