Add .usbram section handling to linker scripts and makefile.

This commit is contained in:
Jared Boone
2012-10-06 17:33:17 -07:00
parent 182157a19c
commit f68fdaba7a
5 changed files with 47 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2012 Michael Ossmann <mike@ossmann.com> * Copyright 2012 Michael Ossmann <mike@ossmann.com>
* Copyright 2012 Jared Boone <jared@sharebrained.com>
* *
* This file is part of HackRF * This file is part of HackRF
* *
@ -32,3 +33,5 @@ MEMORY
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx.ld INCLUDE libopencm3_lpc43xx.ld
INCLUDE usbram.ld

View File

@ -1,6 +1,7 @@
/* /*
* Copyright 2012 Michael Ossmann <mike@ossmann.com> * Copyright 2012 Michael Ossmann <mike@ossmann.com>
* Copyright (C) 2012 Benjamin Vernoux <titanmkd@gmail.com> * Copyright (C) 2012 Benjamin Vernoux <titanmkd@gmail.com>
* Copyright 2012 Jared Boone <jared@sharebrained.com>
* *
* This file is part of HackRF * This file is part of HackRF
* *
@ -36,3 +37,5 @@ MEMORY
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx_rom_to_ram.ld INCLUDE libopencm3_lpc43xx_rom_to_ram.ld
INCLUDE usbram.ld

View File

@ -1,5 +1,6 @@
/* /*
* Copyright 2012 Michael Ossmann <mike@ossmann.com> * Copyright 2012 Michael Ossmann <mike@ossmann.com>
* Copyright 2012 Jared Boone <jared@sharebrained.com>
* *
* This file is part of HackRF * This file is part of HackRF
* *
@ -30,3 +31,5 @@ MEMORY
/* Include the common ld script. */ /* Include the common ld script. */
INCLUDE libopencm3_lpc43xx_ram_only.ld INCLUDE libopencm3_lpc43xx_ram_only.ld
INCLUDE usbram.ld

View File

@ -4,6 +4,7 @@
# Copyright 2010 Piotr Esden-Tempski <piotr@esden.net> # Copyright 2010 Piotr Esden-Tempski <piotr@esden.net>
# Copyright 2012 Michael Ossmann <mike@ossmann.com> # Copyright 2012 Michael Ossmann <mike@ossmann.com>
# Copyright 2012 Benjamin Vernoux <titanmkd@gmail.com> # Copyright 2012 Benjamin Vernoux <titanmkd@gmail.com>
# Copyright 2012 Jared Boone <jared@sharebrained.com>
# #
# This file is part of HackRF. # This file is part of HackRF.
# #
@ -51,6 +52,7 @@ CFLAGS += -std=c99 -O2 -g3 -Wall -Wextra -I$(LIBOPENCM3)/include -I../common \
$(HACKRF_OPTS) $(HACKRF_OPTS)
#LDSCRIPT ?= $(BINARY).ld #LDSCRIPT ?= $(BINARY).ld
LDFLAGS += -L$(TOOLCHAIN_DIR)/lib/armv7e-m/fpu \ LDFLAGS += -L$(TOOLCHAIN_DIR)/lib/armv7e-m/fpu \
-L../common \
-L$(LIBOPENCM3)/lib -L$(LIBOPENCM3)/lib/lpc43xx \ -L$(LIBOPENCM3)/lib -L$(LIBOPENCM3)/lib/lpc43xx \
-T$(LDSCRIPT) -nostartfiles \ -T$(LDSCRIPT) -nostartfiles \
-Wl,--gc-sections -Xlinker -Map=$(BINARY).map -Wl,--gc-sections -Xlinker -Map=$(BINARY).map
@ -78,7 +80,7 @@ flash: $(BINARY).flash
%.bin: %.elf %.bin: %.elf
@#printf " OBJCOPY $(*).bin\n" @#printf " OBJCOPY $(*).bin\n"
$(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin $(Q)$(OBJCOPY) -Obinary -R .usbram $(*).elf $(*).bin
%.hex: %.elf %.hex: %.elf
@#printf " OBJCOPY $(*).hex\n" @#printf " OBJCOPY $(*).hex\n"

35
firmware/common/usbram.ld Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright 2012 Jared Boone <jared@sharebrained.com>
*
* This file is part of HackRF
*
* This program 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 2, or (at your option)
* any later version.
*
* This program 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
SECTIONS
{
. = ORIGIN(ram_ahb);
.usbram : {
. = ALIGN(4096);
*(.usb_data)
. = ALIGN(2048);
*(.usb_qh)
. = ALIGN(64);
*(.usb_td)
} >ram_ahb
}