diff options
author | Nick Foster <nick@nerdnetworks.org> | 2011-04-21 19:45:05 -0700 |
---|---|---|
committer | Nick Foster <nick@nerdnetworks.org> | 2011-04-21 19:45:05 -0700 |
commit | 3dd74062fc6cfad68a62faac6669bada96f3aecf (patch) | |
tree | 9179979b9245e4ea5979100701ac017f52c74d62 /firmware/zpu | |
parent | f9080d0a3f7d6b0478150581a0c2e8af3f4e3c95 (diff) | |
download | uhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.tar.gz uhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.tar.bz2 uhd-3dd74062fc6cfad68a62faac6669bada96f3aecf.zip |
N210: Moved u2p_init into main app and changed bootloader behavior to not load safe fw if safe mode button pressed
Diffstat (limited to 'firmware/zpu')
-rw-r--r-- | firmware/zpu/apps/txrx_uhd.c | 7 | ||||
-rwxr-xr-x | firmware/zpu/bin/bin_to_ram_macro_init.py | 24 | ||||
-rw-r--r-- | firmware/zpu/lib/u2_init.c | 7 | ||||
-rw-r--r-- | firmware/zpu/usrp2p/bootloader/udp_bootloader.c | 11 |
4 files changed, 23 insertions, 26 deletions
diff --git a/firmware/zpu/apps/txrx_uhd.c b/firmware/zpu/apps/txrx_uhd.c index 12f173f5c..8c27618e9 100644 --- a/firmware/zpu/apps/txrx_uhd.c +++ b/firmware/zpu/apps/txrx_uhd.c @@ -39,6 +39,10 @@ #include <string.h> #include <stdbool.h> +#ifdef USRP2P +#include "u2p_init.h" +#endif + extern uint16_t dsp0_dst_port, err0_dst_port, dsp1_dst_port; static void handle_udp_data_packet( @@ -284,6 +288,9 @@ int main(void) { u2_init(); +#ifdef USRP2P + u2p_init(); +#endif putstr("\nTxRx-UHD-ZPU\n"); print_mac_addr(ethernet_mac_addr()); newline(); diff --git a/firmware/zpu/bin/bin_to_ram_macro_init.py b/firmware/zpu/bin/bin_to_ram_macro_init.py index 2958b7202..bf8abb19a 100755 --- a/firmware/zpu/bin/bin_to_ram_macro_init.py +++ b/firmware/zpu/bin/bin_to_ram_macro_init.py @@ -3,6 +3,8 @@ import struct import sys +BOOTRAM_SIZE = 16384 + def do_8_words(ofile, which_ram, row, words): ofile.write("defparam bootram.RAM%d.INIT_%02X=256'h" % (which_ram, row)) ofile.write("%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x;\n" % ( @@ -21,25 +23,13 @@ def bin_to_ram_macro_init(bin_input_file, ram_init_output_file): if r != 0: words += (8 - r) * (0,) - if len(words) > 4096: - sys.stderr.write("bin_to_macro_init: error: input file %s is > 16KiB\n" % (bin_input_file,)) + if len(words) > (BOOTRAM_SIZE / 4): + sys.stderr.write("bin_to_macro_init: error: input file %s is > %dKiB\n" % (bin_input_file,BOOTRAM_SIZE)) sys.exit(1) - # first 2KB - for i in range(0, min(512, len(words)), 8): - do_8_words(ofile, 0, i/8, words[i:i+8]) - - # second 2KB - for i in range(512, min(1024, len(words)), 8): - do_8_words(ofile, 1, (i/8) % 64, words[i:i+8]) - - # third 2KB - for i in range(1024, min(1536, len(words)), 8): - do_8_words(ofile, 2, (i/8) % 64, words[i:i+8]) - - # last 2KB - for i in range(1536, len(words), 8): - do_8_words(ofile, 3, (i/8) % 64, words[i:i+8]) + for q in range(0, BOOTRAM_SIZE/4, 512): + for i in range(q, min(q+512, len(words)), 8): + do_8_words(ofile, int(q / 512), (i/8) % 64, words[i:i+8]) if __name__ == '__main__': if len(sys.argv) != 3: diff --git a/firmware/zpu/lib/u2_init.c b/firmware/zpu/lib/u2_init.c index db26be538..71bd2c594 100644 --- a/firmware/zpu/lib/u2_init.c +++ b/firmware/zpu/lib/u2_init.c @@ -26,9 +26,6 @@ #include "clocks.h" #include "usrp2/fw_common.h" #include "nonstdio.h" -#ifdef USRP2P -#include "u2p_init.h" -#endif /* * We ought to arrange for this to be called before main, but for now, @@ -53,10 +50,6 @@ u2_init(void) i2c_init(); hal_enable_ints(); -#ifdef USRP2P - u2p_init(); -#endif - // flash all leds to let us know board is alive hal_set_led_src(0x0, 0x1f); /* software ctrl */ hal_set_leds(0x0, 0x1f); mdelay(300); diff --git a/firmware/zpu/usrp2p/bootloader/udp_bootloader.c b/firmware/zpu/usrp2p/bootloader/udp_bootloader.c index 00b54f364..118de2ae9 100644 --- a/firmware/zpu/usrp2p/bootloader/udp_bootloader.c +++ b/firmware/zpu/usrp2p/bootloader/udp_bootloader.c @@ -51,6 +51,8 @@ #include <xilinx_s3_icap.h> #include <mdelay.h> +#define BUTTON_PUSHED ((router_status->irqs & PIC_BUTTON) ? 0 : 1) + static void handle_inp_packet(uint32_t *buff, size_t num_lines){ //test if its an ip recovery packet @@ -97,8 +99,11 @@ static void do_the_bootload_thing(void) { set_safe_booted_flag(0); //haven't booted yet if(BUTTON_PUSHED) { //see memory_map.h - puts("Starting USRP2+ in safe mode."); - if(is_valid_fw_image(SAFE_FW_IMAGE_LOCATION_ADDR)) { + puts("Starting USRP2+ in safe mode. I am a brick. Feel free to reprogram me via the UDP burner."); + return; + //no longer necessary since we can just burn from UDP via the bootloader now +/* + if(is_valid_fw_image(SAFE_FW_IMAGE_LOCATION_ADDR)) { set_safe_booted_flag(1); //let the firmware know it's the safe image spi_flash_read(SAFE_FW_IMAGE_LOCATION_ADDR, FW_IMAGE_SIZE_BYTES, (void *)RAM_BASE); start_program(); @@ -108,6 +113,7 @@ static void do_the_bootload_thing(void) { puts("ERROR: no safe firmware image available. I am a brick. Feel free to reprogram me via the UDP burner."); return; } +*/ } if(!production_image) { @@ -150,6 +156,7 @@ int main(void) { u2_init(); + spif_init(); set_default_mac_addr(); set_default_ip_addr(); |