From 94981131edbe7bb7cc4261d73de0d476f386b6fa Mon Sep 17 00:00:00 2001 From: eb Date: Sat, 4 Oct 2008 01:29:47 +0000 Subject: [PATCH] USRP2 firmware fixes for EDK 10.1 microblaze toolchain. Firmware now builds and runs correctly using these tools. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9708 221aa14e-8319-0410-a670-987f0aec2ac5 --- usrp2/firmware/Makefile.common | 11 ++++++----- usrp2/firmware/lib/Makefile.am | 2 ++ usrp2/firmware/lib/abort.c | 32 ++++++++++++++++++++++++++++++++ usrp2/firmware/lib/db_init.c | 18 ++++++------------ usrp2/firmware/lib/exit.c | 28 ++++++++++++++++++++++++++++ usrp2/firmware/lib/u2_init.c | 1 - 6 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 usrp2/firmware/lib/abort.c create mode 100644 usrp2/firmware/lib/exit.c diff --git a/usrp2/firmware/Makefile.common b/usrp2/firmware/Makefile.common index f2f8f7d6..01571139 100644 --- a/usrp2/firmware/Makefile.common +++ b/usrp2/firmware/Makefile.common @@ -31,11 +31,12 @@ AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul -mxl-barrel-shift #AM_CFLAGS = $(STD_CFLAGS) -mno-xl-soft-mul -mxl-barrel-shift -LINKER_SCRIPT = $(top_srcdir)/lib/microblaze.ld -#AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT) -Wl,-defsym -Wl,_STACK_SIZE=1024 -#AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT) -Wl,-Map -Wl,$@.map -AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT) - +#LINKER_SCRIPT = $(top_srcdir)/lib/microblaze.ld +#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-defsym -Wl,_STACK_SIZE=1024 +#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-Map -Wl,$@.map +#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) +#AM_LDFLAGS = -Wl,-Map -Wl,$@.map -Wl,-defsym -Wl,_STACK_SIZE=2048 +AM_LDFLAGS = -Wl,-defsym -Wl,_STACK_SIZE=2048 %.bin : % mb-objcopy -O binary $< $@ diff --git a/usrp2/firmware/lib/Makefile.am b/usrp2/firmware/lib/Makefile.am index a6dd47f6..4fbdd674 100644 --- a/usrp2/firmware/lib/Makefile.am +++ b/usrp2/firmware/lib/Makefile.am @@ -22,6 +22,7 @@ noinst_LIBRARIES = \ libu2fw_a_SOURCES = \ + abort.c \ ad9510.c \ ad9777.c \ buffer_pool.c \ @@ -34,6 +35,7 @@ libu2fw_a_SOURCES = \ eeprom.c \ ethernet.c \ eth_mac.c \ + exit.c \ hal_io.c \ hal_uart.c \ i2c.c \ diff --git a/usrp2/firmware/lib/abort.c b/usrp2/firmware/lib/abort.c new file mode 100644 index 00000000..d1d70939 --- /dev/null +++ b/usrp2/firmware/lib/abort.c @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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, or (at your option) + * any later version. + * + * GNU Radio 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +extern void _exit(int status); + +void +abort(void) +{ + putstr("\n\nabort\n"); + // FIXME loop blinking leds + _exit(-1); +} diff --git a/usrp2/firmware/lib/db_init.c b/usrp2/firmware/lib/db_init.c index d47beb11..3d49a51d 100644 --- a/usrp2/firmware/lib/db_init.c +++ b/usrp2/firmware/lib/db_init.c @@ -211,19 +211,13 @@ calc_dxc_freq(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t baseband_freq, u2_fxpt_freq_t fs = U2_DOUBLE_TO_FXPT_FREQ(100e6); // converter sample rate u2_fxpt_freq_t delta = target_freq - baseband_freq; +#if 0 printf("calc_dxc_freq\n"); printf(" fs = "); print_fxpt_freq(fs); newline(); printf(" target = "); print_fxpt_freq(target_freq); newline(); printf(" baseband = "); print_fxpt_freq(baseband_freq); newline(); printf(" delta = "); print_fxpt_freq(delta); newline(); - -#if 0 - printf("--- printed as uint64_t ---\n"); - printf(" fs = "); print_uint64(fs); newline(); - printf(" target = "); print_uint64(target_freq); newline(); - printf(" baseband = "); print_uint64(baseband_freq); newline(); - printf(" delta = "); print_uint64(delta); newline(); -#endif +#endif if (delta >= 0){ while (delta > fs) @@ -301,17 +295,17 @@ compute_freq_control_word(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t *actual_fre // master = 100e6; // v = (int) rint(target_freq / master_freq) * pow(2.0, 32.0); - printf("compute_freq_control_word\n"); - printf(" target_freq = "); print_fxpt_freq(target_freq); newline(); + //printf("compute_freq_control_word\n"); + //printf(" target_freq = "); print_fxpt_freq(target_freq); newline(); int32_t master_freq = 100000000; // 100M int32_t v = ((target_freq << 12)) / master_freq; - printf(" fcw = %d\n", v); + //printf(" fcw = %d\n", v); *actual_freq = (v * (int64_t) master_freq) >> 12; - printf(" actual = "); print_fxpt_freq(*actual_freq); newline(); + //printf(" actual = "); print_fxpt_freq(*actual_freq); newline(); return v; } diff --git a/usrp2/firmware/lib/exit.c b/usrp2/firmware/lib/exit.c new file mode 100644 index 00000000..95a3bf4d --- /dev/null +++ b/usrp2/firmware/lib/exit.c @@ -0,0 +1,28 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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, or (at your option) + * any later version. + * + * GNU Radio 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +extern void _exit(int status); + +void +exit(int status) +{ + _exit(status); +} diff --git a/usrp2/firmware/lib/u2_init.c b/usrp2/firmware/lib/u2_init.c index 3a896137..4313c950 100644 --- a/usrp2/firmware/lib/u2_init.c +++ b/usrp2/firmware/lib/u2_init.c @@ -44,7 +44,6 @@ get_hw_rev(void) ok &= eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &u2_hw_rev_major, 1); } - /* * We ought to arrange for this to be called before main, but for now, * we require that the user's main call u2_init as the first thing... -- 2.30.2