From deeefd2e53795500ebb2afcc0b4d97e84eb7f7e9 Mon Sep 17 00:00:00 2001 From: Pixel Date: Sat, 29 Jan 2011 19:58:11 -0800 Subject: Adding sample code for the romfs into the demo, and into the makefile. --- demo.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'demo.c') diff --git a/demo.c b/demo.c index cde181a..fbf2b26 100644 --- a/demo.c +++ b/demo.c @@ -6,6 +6,7 @@ #include #include #include +#include #define LED1_wire 18 #define LED2_wire 20 @@ -62,16 +63,25 @@ static void badTask(void *x) { static const char msg[] = "Hello world - from fwrite!\r\n"; +extern uint8_t _binary_test_romfs_bin_start[]; + int main() { - FILE * f; + FILE * f1, * f2; + char buf[32]; + int c; register_devfs(); + register_romfs("romfs", _binary_test_romfs_bin_start); handle = xSemaphoreCreateMutex(); printf("Hello world - from stdio!\r\n"); fflush(stdout); - f = fopen("/dev/stdout", "w"); - fwrite(msg, 1, sizeof(msg), f); - fflush(f); - fclose(f); + f1 = fopen("/dev/stdout", "w"); + fwrite(msg, 1, sizeof(msg), f1); + f2 = fopen("/romfs/test.txt", "r"); + c = fread(buf, 1, 32, f2); + fwrite(buf, 1, c, f1); + fflush(f1); + fclose(f1); + fclose(f2); setupLEDs(); litLED(1, 0); litLED(2, 0); -- cgit v1.2.3