From 4ba796417d40d4e8aa0244743126d8c268226c42 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 24 Nov 2013 23:50:09 +0100 Subject: [PATCH] software: do not attempt to build network/sdram drivers when cores are not present --- software/bios/boot.c | 4 ++++ software/bios/main.c | 19 ++++++++++++++++++- software/bios/sdram.c | 6 +++++- software/libnet/microudp.c | 6 +++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/software/bios/boot.c b/software/bios/boot.c index 93ae18cb..3c505e1c 100644 --- a/software/bios/boot.c +++ b/software/bios/boot.c @@ -175,6 +175,8 @@ void serialboot(void) } } +#ifdef MINIMAC_BASE + #define LOCALIP1 192 #define LOCALIP2 168 #define LOCALIP3 0 @@ -237,6 +239,8 @@ void netboot(void) boot(cmdline_adr, initrdstart_adr, initrdend_adr, SDRAM_BASE); } +#endif + void flashboot(void) { unsigned int *flashbase; diff --git a/software/bios/main.c b/software/bios/main.c index 922d3e2a..c22a12a7 100644 --- a/software/bios/main.c +++ b/software/bios/main.c @@ -306,7 +306,6 @@ static void dfs(char *baseaddr) static void help(void) { puts("MiSoC BIOS"); - puts("Don't know what to do? Try 'flashboot'.\n"); puts("Available commands:"); puts("mr - read address space"); puts("mw - write address space"); @@ -314,7 +313,9 @@ static void help(void) puts("crc - compute CRC32 of a part of the address space"); puts("rcsr - read processor CSR"); puts("wcsr - write processor CSR"); +#ifdef MINIMAC_BASE puts("netboot - boot via TFTP"); +#endif puts("serialboot - boot via SFL"); puts("flashboot - boot from flash"); puts("revision - display revision"); @@ -350,7 +351,9 @@ static void do_command(char *c) else if(strcmp(token, "flashboot") == 0) flashboot(); else if(strcmp(token, "serialboot") == 0) serialboot(); +#ifdef MINIMAC_BASE else if(strcmp(token, "netboot") == 0) netboot(); +#endif else if(strcmp(token, "revision") == 0) printf("%08x\n", GIT_ID); @@ -359,6 +362,7 @@ static void do_command(char *c) else if(strcmp(token, "rcsr") == 0) rcsr(get_token(&c)); else if(strcmp(token, "wcsr") == 0) wcsr(get_token(&c), get_token(&c)); +#ifdef DFII_BASE else if(strcmp(token, "ddrrow") == 0) ddrrow(get_token(&c)); else if(strcmp(token, "ddrsw") == 0) ddrsw(); else if(strcmp(token, "ddrhw") == 0) ddrhw(); @@ -366,6 +370,7 @@ static void do_command(char *c) else if(strcmp(token, "ddrwr") == 0) ddrwr(get_token(&c)); else if(strcmp(token, "memtest") == 0) memtest(); else if(strcmp(token, "ddrinit") == 0) ddrinit(); +#endif else if(strcmp(token, "dfs") == 0) dfs(get_token(&c)); @@ -440,7 +445,9 @@ static int test_user_abort(void) printf("Automatic boot in 2 seconds...\n"); printf("Q/ESC: abort boot\n"); printf("F7: boot from serial\n"); +#ifdef MINIMAC_BASE printf("F8: boot from network\n"); +#endif timer0_en_write(0); timer0_reload_write(0); timer0_load_write(identifier_frequency_read()*2); @@ -457,10 +464,12 @@ static int test_user_abort(void) serialboot(); return 0; } +#ifdef MINIMAC_BASE if(c == 0x07) { netboot(); return 0; } +#endif } timer0_update_value_write(1); } @@ -472,7 +481,9 @@ static void boot_sequence(void) if(test_user_abort()) { flashboot(); serialboot(); +#ifdef MINIMAC_BASE netboot(); +#endif printf("No boot medium found\n"); } } @@ -490,8 +501,14 @@ int main(int i, char **c) printf("Revision %08x built "__DATE__" "__TIME__"\n\n", GIT_ID); crcbios(); id_print(); +#ifdef MINIMAC_BASE ethreset(); +#endif +#ifdef DFII_BASE ddr_ok = ddrinit(); +#else + ddr_ok = 1; +#endif if(ddr_ok) boot_sequence(); else diff --git a/software/bios/sdram.c b/software/bios/sdram.c index 3a4fed44..cb053962 100644 --- a/software/bios/sdram.c +++ b/software/bios/sdram.c @@ -1,7 +1,9 @@ +#include +#ifdef DFII_BASE + #include #include -#include #include #include #include @@ -157,3 +159,5 @@ int ddrinit(void) return 1; } + +#endif diff --git a/software/libnet/microudp.c b/software/libnet/microudp.c index 09e4c40e..6cd2f1eb 100644 --- a/software/libnet/microudp.c +++ b/software/libnet/microudp.c @@ -1,7 +1,9 @@ +#include +#ifdef MINIMAC_BASE + #include #include #include -#include #include #include @@ -407,3 +409,5 @@ void ethreset(void) minimac_phy_reset_write(0); busy_wait(2); } + +#endif -- 2.30.2