[PATCH ath9k-htc-fw 3/3] firmware: rewrite build system using cmake

Felix Fietkau nbd at openwrt.org
Sat Apr 6 07:44:49 EDT 2013


Call the firmware build from the top-level Makefile (depends
on the toolchain build).

Signed-off-by: Felix Fietkau <nbd at openwrt.org>
---
 Makefile                            |  12 +-
 build                               |  22 ---
 target_firmware/.gitignore          |   3 +
 target_firmware/CMakeLists.txt      | 124 +++++++++++++++++
 target_firmware/Makefile            |   8 ++
 target_firmware/configure           |  31 +++++
 target_firmware/firmware-crc.pl     |  11 ++
 target_firmware/ram-k2.ld           | 261 ++++++++++++++++++++++++++++++++++++
 target_firmware/ram-magpie.ld       | 261 ++++++++++++++++++++++++++++++++++++
 target_firmware/rom-addrs-k2.ld     |  69 ++++++++++
 target_firmware/rom-addrs-magpie.ld |  74 ++++++++++
 11 files changed, 851 insertions(+), 25 deletions(-)
 delete mode 100755 build
 create mode 100644 target_firmware/.gitignore
 create mode 100644 target_firmware/CMakeLists.txt
 create mode 100644 target_firmware/Makefile
 create mode 100755 target_firmware/configure
 create mode 100755 target_firmware/firmware-crc.pl
 create mode 100755 target_firmware/ram-k2.ld
 create mode 100755 target_firmware/ram-magpie.ld
 create mode 100755 target_firmware/rom-addrs-k2.ld
 create mode 100755 target_firmware/rom-addrs-magpie.ld

diff --git a/Makefile b/Makefile
index 21bc1f0..59c6f49 100644
--- a/Makefile
+++ b/Makefile
@@ -120,14 +120,20 @@ download: $(DL_DIR)/$($(1)_DIR)/.prepared
 
 endef
 
-all: toolchain
-clean:
+all: toolchain firmware
+toolchain-clean:
 	rm -rf $(TOOLCHAIN_DIR)/build $(TOOLCHAIN_DIR)/inst
 clean-dl:
 download:
 toolchain:
 
-.PHONY: all clean clean-dl download toolchain
+clean:
+	$(MAKE) -C target_firmware clean
+
+firmware: toolchain
+	+$(MAKE) -C target_firmware
+
+.PHONY: all toolchain-clean clean clean-dl download toolchain firmware
 
 $(eval $(call Build,GMP))
 $(eval $(call Build,MPFR,GMP))
diff --git a/build b/build
deleted file mode 100755
index 2ccaff6..0000000
--- a/build
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-
-rm htc_9271.fw
-rm htc_7010.fw
-
-# MAKE=gmake
-MAKE=make
-
-echo "*** AR9271 ***"
-( cd target_firmware/magpie_fw_dev/build/k2_1_0/image/k2_ram	\
-    && source builds_fusion_vista.ram				\
-    && ${MAKE} clean ; ${MAKE} && ${MAKE} build && ${MAKE} build )
-cp target_firmware/magpie_fw_dev/build/k2_1_0/image/k2_ram/htc_9271.fw .
-
-echo "*** AR7010 ***"
-( cd target_firmware/magpie_fw_dev/build/magpie_1_1/image/magpie_ram	\
-    && source merlin_fusion.ram					\
-    && ${MAKE} clean ; ${MAKE} && ${MAKE} build && ${MAKE} build )
-
-cp target_firmware/magpie_fw_dev/build/magpie_1_1/image/magpie_ram/htc_7010.fw .
-
-echo "*** Done! ***"
diff --git a/target_firmware/.gitignore b/target_firmware/.gitignore
new file mode 100644
index 0000000..36b2c17
--- /dev/null
+++ b/target_firmware/.gitignore
@@ -0,0 +1,3 @@
+/build
+/toolchain
+/*.fw
diff --git a/target_firmware/CMakeLists.txt b/target_firmware/CMakeLists.txt
new file mode 100644
index 0000000..193399e
--- /dev/null
+++ b/target_firmware/CMakeLists.txt
@@ -0,0 +1,124 @@
+SET(CMAKE_C_COMPILER_WORKS 1)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ath9k_firmware NONE)
+ENABLE_LANGUAGE(C)
+
+ADD_DEFINITIONS(-g -Os -Wunused-label -Wunused-variable -Wunused-value -Wpointer-arith -Wundef -nostdlib -Wundef)
+ADD_DEFINITIONS(
+	-D_RAM_
+	-DBIG_ENDIAN -D_BYTE_ORDER=_BIG_ENDIAN
+	-D__XTENSA__
+	-DFUSION_USB_FW -DRX_SCATTER
+	-DFUSION_USB_ENABLE_TX_STREAM -DFUSION_USB_ENABLE_RX_STREAM
+	-DATH_ENABLE_CABQ
+)
+
+SET(SOURCES
+	magpie_fw_dev/target/init/app_start.c
+	magpie_fw_dev/target/init/init.c
+	magpie_fw_dev/target/init/magpie.c
+	magpie_fw_dev/target/adf/adf_nbuf.c
+	magpie_fw_dev/target/adf/adf_net.c
+	magpie_fw_dev/target/adf/adf_os_defer_pvt.c
+	magpie_fw_dev/target/adf/adf_os_dma.c
+	magpie_fw_dev/target/adf/adf_os_irq_pvt.c
+	magpie_fw_dev/target/adf/adf_os_timer.c
+	magpie_fw_dev/target/buf_pool/buf_pool_static.c
+	magpie_fw_dev/target/cmnos/dbg_api.c
+	magpie_fw_dev/target/cmnos/cmnos_sflash.c
+	wlan/ah.c
+	wlan/ah_osdep.c
+	wlan/ar5416Phy.c
+	wlan/ar5416_hw.c
+	wlan/ar5416_phy.c
+	wlan/ratectrl_11n_ln.c
+	wlan/if_owl.c
+	wlan/if_ath.c
+	wlan/if_ath_pci.c
+	magpie_fw_dev/target/wlan/wlan_pci.c
+	wlan/ieee80211_output.c
+	magpie_fw_dev/target/htc/htc.c
+	magpie_fw_dev/target/wmi/wmi_svc.c
+)
+
+IF(TARGET_K2)
+	SET(SOURCES ${SOURCES}
+		magpie_fw_dev/target/hif/k2_HIF_usb_patch.c
+		magpie_fw_dev/target/hif/k2_fw_usb_api.c
+	)
+	SET(LIBS ${LIBS} hif)
+	ADD_DEFINITIONS(-DPROJECT_K2)
+	SET(PLATFORM_NAME k2)
+	SET(SOURCES ${SOURCES}
+		magpie_fw_dev/target/cmnos/k2_cmnos_clock_patch.c
+		magpie_fw_dev/target/cmnos/k2_fw_cmnos_printf.c
+	)
+	SET(FIRMWARE_NAME htc_9271.fw)
+ELSEIF(TARGET_MAGPIE)
+	ADD_DEFINITIONS(
+		-DROM_VER_1_1 -D_ROM_1_1_
+		-DPROJECT_MAGPIE
+		-DMAGPIE_MERLIN
+	)
+	SET(SOURCES ${SOURCES}
+		magpie_fw_dev/target/rompatch/cmnos_clock_patch.c
+		magpie_fw_dev/target/rompatch/usb_api_patch.c
+		magpie_fw_dev/target/rompatch/HIF_usb_patch.c
+	)
+	INCLUDE_DIRECTORIES(
+		${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
+		magpie_fw_dev/build/magpie_1_1/inc
+		magpie_fw_dev/build/magpie_1_1/inc/magpie
+	)
+	SET(PLATFORM_NAME magpie)
+	SET(FIRMWARE_NAME htc_7010.fw)
+ELSE()
+	MESSAGE(FATAL_ERROR "Unknown target name")
+ENDIF()
+
+INCLUDE_DIRECTORIES(
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/build/include
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/build/include/xtensa-elf
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/inc/${PLATFORM_NAME}/${PLATFORM_NAME}
+	${CMAKE_SOURCE_DIR}/wlan
+	${CMAKE_SOURCE_DIR}/wlan/include
+	${CMAKE_SOURCE_DIR}/wlan/include/${PLATFORM_NAME}
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wlan
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/cmnos
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/wmi
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/adf
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/buf_pool
+	${CMAKE_SOURCE_DIR}/magpie_fw_dev/target/htc
+)
+
+ADD_LIBRARY(firmware ${SOURCES})
+
+ADD_CUSTOM_COMMAND(
+	OUTPUT fw.elf
+	DEPENDS firmware
+	COMMAND ${CMAKE_C_COMPILER}
+		-nostdlib
+		-Wl,--start-group
+		${CMAKE_BINARY_DIR}/libfirmware.a
+		-Wl,--end-group
+		-Wl,-T,${CMAKE_SOURCE_DIR}/ram-${PLATFORM_NAME}.ld
+		-Wl,-T,${CMAKE_SOURCE_DIR}/rom-addrs-${PLATFORM_NAME}.ld
+		-o fw.elf
+)
+ADD_CUSTOM_COMMAND(
+	OUTPUT fw.bin
+	DEPENDS fw.elf
+	COMMAND ${CMAKE_OBJCOPY}
+		--change-section-lma .text-0x400000
+		--change-section-vma .text-0x400000
+		-O binary fw.elf fw.bin
+)
+ADD_CUSTOM_COMMAND(
+	OUTPUT ${FIRMWARE_NAME}
+	DEPENDS fw.bin
+	COMMAND ${CMAKE_SOURCE_DIR}/firmware-crc.pl < fw.bin > ${FIRMWARE_NAME}
+)
+ADD_CUSTOM_TARGET(gen-firmware ALL DEPENDS ${FIRMWARE_NAME})
diff --git a/target_firmware/Makefile b/target_firmware/Makefile
new file mode 100644
index 0000000..d08e3cd
--- /dev/null
+++ b/target_firmware/Makefile
@@ -0,0 +1,8 @@
+all:
+	[ -d build ] || ./configure || { rm -rf build; false; }
+	+$(MAKE) -C build/k2
+	+$(MAKE) -C build/magpie
+	cp build/k2/htc_*.fw build/magpie/htc_*.fw .
+
+clean:
+	rm -rf build htc_*.fw
diff --git a/target_firmware/configure b/target_firmware/configure
new file mode 100755
index 0000000..5a6833b
--- /dev/null
+++ b/target_firmware/configure
@@ -0,0 +1,31 @@
+#!/bin/sh
+TOOLCHAIN=$PWD/toolchain
+TARGET=xtensa-elf
+PREFIX="$TOOLCHAIN/bin/$TARGET-"
+TOOLCHAIN_FILE=$PWD/build/toolchain.cmake
+
+set -e
+rm -rf build
+mkdir -p build
+
+cat > "$TOOLCHAIN_FILE" <<EOF
+INCLUDE(CMakeForceCompiler)
+
+SET(CMAKE_SYSTEM_PROCESSOR xtensa)
+SET(CMAKE_FIND_ROOT_PATH ${TOOLCHAIN}/$TARGET)
+SET(CMAKE_STRIP :)
+
+CMAKE_FORCE_C_COMPILER(${PREFIX}gcc GNU)
+EOF
+
+do_cmake() {
+	cmake -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE "$@"
+}
+
+mkdir -p build/k2 build/magpie
+cd build/k2
+do_cmake -DTARGET_K2=ON ../..
+cd -
+cd build/magpie
+do_cmake -DTARGET_MAGPIE=ON ../..
+cd -
diff --git a/target_firmware/firmware-crc.pl b/target_firmware/firmware-crc.pl
new file mode 100755
index 0000000..2e8c9d3
--- /dev/null
+++ b/target_firmware/firmware-crc.pl
@@ -0,0 +1,11 @@
+#!/usr/bin/env perl
+use strict;
+my $crc = 0;
+my $bytes;
+my $buf;
+while (($bytes = read(STDIN, $buf, 4)) == 4) {
+	print $buf;
+	my $v = unpack("N", $buf);
+	$crc = $crc ^ $v;
+}
+print pack("N", $crc);
diff --git a/target_firmware/ram-k2.ld b/target_firmware/ram-k2.ld
new file mode 100755
index 0000000..9f255df
--- /dev/null
+++ b/target_firmware/ram-k2.ld
@@ -0,0 +1,261 @@
+
+/* Linker script for Magpie RAM-based applications */
+
+/*
+Currently, ROM code reserves the first 8KB of RAM for its data/bss.
+The next 12KB or RAM is used for RAM software's literals and read-only data.
+After that comes 64KB reserved for RAM software's data and bss.
+Then 92KB of RAM is reserved for text (code).
+The last 8KB of RAM is reserved for ROM patches, customer DataSets,
+and RAM software expansion. (There is also some additional RAM between
+segments that can be used, if needed.)
+  ROM reserved: 0x00500000..0x00501fff
+  Literals:     0x00502000..0x00504fff
+  Data:         0x00505000..0x00514fff
+  Text:         0x00915000..0x0092bfff
+TBD: May want to use a 2-pass link approach in order to
+eliminate fixed boundaries.  Support for physical addressing
+in Tensilica tools would be helpful, but it's not coming
+any time soon.
+*/
+
+/* dram_seg: 0x504000, see target.rom.ld */
+
+/* ***** */
+MEMORY
+{
+ lit_seg :            org = 0x004E5200,   len = 0x1DE00
+ iram_seg :           org = 0x00903000,   len = 0x9B40
+ dram_seg :           org = 0x0050CB40,   len = 0x1800
+
+}
+
+PHDRS
+{
+  lit_phdr PT_LOAD;
+  dram_phdr PT_LOAD;
+  iram_phdr PT_LOAD;
+}
+
+/*  Default entry point:  */
+ENTRY(app_start)
+
+SECTIONS
+{
+  /*
+   * This empty section is used to convince RAM linkage
+   * to share litbase with ROM code.
+   */
+  .lit4 (NOLOAD) :
+  {
+    _rom_literal_start = ABSOLUTE(.);
+    . += 0x1BE00; /* Reserved virtual space for physical mem gap and ROM */
+    _lit4_start = ABSOLUTE(.);
+    _lit4_end = ABSOLUTE(.);
+    _rom_literal_end = ABSOLUTE(.);
+  } >lit_seg :NONE
+
+  .dport0.rodata :
+  {
+    _dport0_rodata_start = ABSOLUTE(.); /* 0x505000 */
+    *(.dport0.rodata)
+    *(.dport.rodata)
+    _dport0_rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dport0.literal :
+  {
+    _dport0_literal_start = ABSOLUTE(.);
+    *(.dport0.literal)
+    *(.dport.literal)
+    _dport0_literal_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dram0.rodata :
+  {
+    _dram0_rodata_start = ABSOLUTE(.);
+    *(.dram0.rodata)
+    *(.dram.rodata)
+    _dram0_rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .rodata :
+  {
+    _rodata_start = ABSOLUTE(.);
+    *(.rodata)
+    *(.rodata.*)
+    *(.gnu.linkonce.r.*)
+    *(.rodata1)
+    __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
+    *(.xt_except_table)
+    *(.gcc_except_table)
+    *(.gnu.linkonce.e.*)
+    *(.gnu.version_r)
+    . = ALIGN(4);		/* this table MUST be 4-byte aligned */
+    _bss_table_start = ABSOLUTE(.);
+    LONG(_dport0_bss_start)
+    LONG(_dport0_bss_end)
+    LONG(_bss_start)
+    LONG(_bss_end)
+    _bss_table_end = ABSOLUTE(.);
+    _rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .literals :
+  {
+    _literals_start = ABSOLUTE(.);
+    *(*.lit4)
+    *(.gnu.linkonce.lit4.*)
+    _literals_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dram0.literal :
+  {
+    _dram0_literal_start = ABSOLUTE(.);
+    *(.dram0.literal)
+    *(.dram.literal)
+    _dram0_literal_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dport0.data :
+  {
+    _dport0_data_start = ABSOLUTE(.);
+    *(.dport0.data)
+    *(.dport.data)
+    _dport0_data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .dport0.bss :
+  {
+    . = ALIGN (8);
+    _dport0_bss_start = ABSOLUTE(.);
+    *(.dport0.bss)
+    . = ALIGN (8);
+    _dport0_bss_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .dram0.data :
+  {
+    _dram0_data_start = ABSOLUTE(.);
+    *(.dram0.data)
+    *(.dram.data)
+    _dram0_data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .data :
+  {
+    _data_start = ABSOLUTE(.);
+    *(.data)
+    *(.data.*)
+    *(.gnu.linkonce.d.*)
+    *(.data1)
+    *(.sdata)
+    *(.sdata.*)
+    *(.gnu.linkonce.s.*)
+    *(.sdata2)
+    *(.sdata2.*)
+    *(.gnu.linkonce.s2.*)
+    *(.jcr)
+    *(.eh_frame)
+    /*  C++ constructor and destructor tables, properly ordered:  */
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+    /*  C++ exception handlers table:  */
+    __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
+    *(.xt_except_desc)
+    *(.gnu.linkonce.h.*)
+    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
+    *(.xt_except_desc_end)
+    *(.dynamic)
+    *(.gnu.version_d)
+    _data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .bss :
+  {
+    . = ALIGN (8);
+    _bss_start = ABSOLUTE(.);
+    *(.dynsbss)
+    *(.sbss)
+    *(.sbss.*)
+    *(.gnu.linkonce.sb.*)
+    *(.scommon)
+    *(.sbss2)
+    *(.sbss2.*)
+    *(.gnu.linkonce.sb2.*)
+    *(.dynbss)
+    *(.bss)
+    *(.bss.*)
+    *(.gnu.linkonce.b.*)
+    *(COMMON)
+    *(.dram0.bss)
+    . = ALIGN (8);
+    _bss_end = ABSOLUTE(.);
+    _end = ALIGN(0x8);
+    PROVIDE(end = ALIGN(0x8));
+	_fw_image_end = ABSOLUTE(.);
+    /*_stack_sentry = ALIGN(0x8);*/
+  } >dram_seg :dram_phdr
+
+  .text :
+  {
+    _stext = .;
+    _text_start = ABSOLUTE(.);
+    *(.entry.text)
+    *(.init.literal)
+    *(.init)
+    *(.literal .text .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
+    *(.fini.literal)
+    *(.fini)
+    *(.gnu.version)
+    _text_end = ABSOLUTE(.);
+    _etext = .;
+  } >iram_seg :iram_phdr
+
+  .iram0.text :
+  {
+    _iram0_text_start = ABSOLUTE(.);
+    *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text)
+    _iram0_text_end = ABSOLUTE(.);
+  } >iram_seg :iram_phdr
+
+  .debug  0 :  { *(.debug) }
+  .line  0 :  { *(.line) }
+  .debug_srcinfo  0 :  { *(.debug_srcinfo) }
+  .debug_sfnames  0 :  { *(.debug_sfnames) }
+  .debug_aranges  0 :  { *(.debug_aranges) }
+  .debug_pubnames  0 :  { *(.debug_pubnames) }
+  .debug_info  0 :  { *(.debug_info) }
+  .debug_abbrev  0 :  { *(.debug_abbrev) }
+  .debug_line  0 :  { *(.debug_line) }
+  .debug_frame  0 :  { *(.debug_frame) }
+  .debug_str  0 :  { *(.debug_str) }
+  .debug_loc  0 :  { *(.debug_loc) }
+  .debug_macinfo  0 :  { *(.debug_macinfo) }
+  .debug_weaknames  0 :  { *(.debug_weaknames) }
+  .debug_funcnames  0 :  { *(.debug_funcnames) }
+  .debug_typenames  0 :  { *(.debug_typenames) }
+  .debug_varnames  0 :  { *(.debug_varnames) }
+
+  .xt.insn 0 :
+  {
+    KEEP (*(.xt.insn))
+    KEEP (*(.gnu.linkonce.x.*))
+  }
+  .xt.prop 0 :
+  {
+    KEEP (*(.xt.prop))
+    KEEP (*(.gnu.linkonce.prop.*))
+  }
+  .xt.lit 0 :
+  {
+    KEEP (*(.xt.lit))
+    KEEP (*(.gnu.linkonce.p.*))
+  }
+}
diff --git a/target_firmware/ram-magpie.ld b/target_firmware/ram-magpie.ld
new file mode 100755
index 0000000..2cf7f30
--- /dev/null
+++ b/target_firmware/ram-magpie.ld
@@ -0,0 +1,261 @@
+
+/* Linker script for Magpie RAM-based applications */
+
+/*
+Currently, ROM code reserves the first 8KB of RAM for its data/bss.
+The next 12KB or RAM is used for RAM software's literals and read-only data.
+After that comes 64KB reserved for RAM software's data and bss.
+Then 92KB of RAM is reserved for text (code).
+The last 8KB of RAM is reserved for ROM patches, customer DataSets,
+and RAM software expansion. (There is also some additional RAM between
+segments that can be used, if needed.)
+  ROM reserved: 0x00500000..0x00501fff
+  Literals:     0x00502000..0x00504fff
+  Data:         0x00505000..0x00514fff
+  Text:         0x00915000..0x0092bfff
+TBD: May want to use a 2-pass link approach in order to
+eliminate fixed boundaries.  Support for physical addressing
+in Tensilica tools would be helpful, but it's not coming
+any time soon.
+*/
+
+/* dram_seg: 0x504000, see target.rom.ld */
+
+/* ***** */
+MEMORY
+{
+ lit_seg :            org = 0x004E8000,   len = 0x1f600
+ iram_seg :           org = 0x00906000,   len = 0xad00
+ dram_seg :           org = 0x00510d00,   len = 0x6000
+ 
+}
+
+PHDRS
+{
+  lit_phdr PT_LOAD;
+  dram_phdr PT_LOAD;
+  iram_phdr PT_LOAD;
+}
+
+/*  Default entry point:  */
+ENTRY(app_start)
+
+SECTIONS
+{
+  /*
+   * This empty section is used to convince RAM linkage
+   * to share litbase with ROM code.
+   */
+  .lit4 (NOLOAD) :
+  {
+    _rom_literal_start = ABSOLUTE(.);
+    . += 0x19000; /* Reserved virtual space for physical mem gap and ROM */
+    _lit4_start = ABSOLUTE(.);
+    _lit4_end = ABSOLUTE(.);
+    _rom_literal_end = ABSOLUTE(.);
+  } >lit_seg :NONE
+
+  .dport0.rodata :
+  {
+    _dport0_rodata_start = ABSOLUTE(.); /* 0x505000 */
+    *(.dport0.rodata)
+    *(.dport.rodata)
+    _dport0_rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dport0.literal :
+  {
+    _dport0_literal_start = ABSOLUTE(.);
+    *(.dport0.literal)
+    *(.dport.literal)
+    _dport0_literal_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dram0.rodata :
+  {
+    _dram0_rodata_start = ABSOLUTE(.);
+    *(.dram0.rodata)
+    *(.dram.rodata)
+    _dram0_rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .rodata :
+  {
+    _rodata_start = ABSOLUTE(.);
+    *(.rodata)
+    *(.rodata.*)
+    *(.gnu.linkonce.r.*)
+    *(.rodata1)
+    __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
+    *(.xt_except_table)
+    *(.gcc_except_table)
+    *(.gnu.linkonce.e.*)
+    *(.gnu.version_r)
+    . = ALIGN(4);		/* this table MUST be 4-byte aligned */
+    _bss_table_start = ABSOLUTE(.);
+    LONG(_dport0_bss_start)
+    LONG(_dport0_bss_end)
+    LONG(_bss_start)
+    LONG(_bss_end)
+    _bss_table_end = ABSOLUTE(.);
+    _rodata_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .literals :
+  {
+    _literals_start = ABSOLUTE(.);
+    *(*.lit4)
+    *(.gnu.linkonce.lit4.*)
+    _literals_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dram0.literal :
+  {
+    _dram0_literal_start = ABSOLUTE(.);
+    *(.dram0.literal)
+    *(.dram.literal)
+    _dram0_literal_end = ABSOLUTE(.);
+  } >lit_seg :lit_phdr
+
+  .dport0.data :
+  {
+    _dport0_data_start = ABSOLUTE(.);
+    *(.dport0.data)
+    *(.dport.data)
+    _dport0_data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .dport0.bss :
+  {
+    . = ALIGN (8);
+    _dport0_bss_start = ABSOLUTE(.);
+    *(.dport0.bss)
+    . = ALIGN (8);
+    _dport0_bss_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .dram0.data :
+  {
+    _dram0_data_start = ABSOLUTE(.);
+    *(.dram0.data)
+    *(.dram.data)
+    _dram0_data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .data :
+  {
+    _data_start = ABSOLUTE(.);
+    *(.data)
+    *(.data.*)
+    *(.gnu.linkonce.d.*)
+    *(.data1)
+    *(.sdata)
+    *(.sdata.*)
+    *(.gnu.linkonce.s.*)
+    *(.sdata2)
+    *(.sdata2.*)
+    *(.gnu.linkonce.s2.*)
+    *(.jcr)
+    *(.eh_frame)
+    /*  C++ constructor and destructor tables, properly ordered:  */
+    KEEP (*crtbegin.o(.ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
+    KEEP (*(SORT(.ctors.*)))
+    KEEP (*(.ctors))
+    KEEP (*crtbegin.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
+    KEEP (*(SORT(.dtors.*)))
+    KEEP (*(.dtors))
+    /*  C++ exception handlers table:  */
+    __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
+    *(.xt_except_desc)
+    *(.gnu.linkonce.h.*)
+    __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
+    *(.xt_except_desc_end)
+    *(.dynamic)
+    *(.gnu.version_d)
+    _data_end = ABSOLUTE(.);
+  } >dram_seg :dram_phdr
+
+  .bss :
+  {
+    . = ALIGN (8);
+    _bss_start = ABSOLUTE(.);
+    *(.dynsbss)
+    *(.sbss)
+    *(.sbss.*)
+    *(.gnu.linkonce.sb.*)
+    *(.scommon)
+    *(.sbss2)
+    *(.sbss2.*)
+    *(.gnu.linkonce.sb2.*)
+    *(.dynbss)
+    *(.bss)
+    *(.bss.*)
+    *(.gnu.linkonce.b.*)
+    *(COMMON)
+    *(.dram0.bss)
+    . = ALIGN (8);
+    _bss_end = ABSOLUTE(.);
+    _end = ALIGN(0x8);
+    PROVIDE(end = ALIGN(0x8));
+	_fw_image_end = ABSOLUTE(.);
+    /*_stack_sentry = ALIGN(0x8);*/
+  } >dram_seg :dram_phdr
+
+  .text :
+  {
+    _stext = .;
+    _text_start = ABSOLUTE(.);
+    *(.entry.text)
+    *(.init.literal)
+    *(.init)
+    *(.literal .text .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
+    *(.fini.literal)
+    *(.fini)
+    *(.gnu.version)
+    _text_end = ABSOLUTE(.);
+    _etext = .;
+  } >iram_seg :iram_phdr
+
+  .iram0.text :
+  {
+    _iram0_text_start = ABSOLUTE(.);
+    *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text)
+    _iram0_text_end = ABSOLUTE(.);
+  } >iram_seg :iram_phdr
+
+  .debug  0 :  { *(.debug) }
+  .line  0 :  { *(.line) }
+  .debug_srcinfo  0 :  { *(.debug_srcinfo) }
+  .debug_sfnames  0 :  { *(.debug_sfnames) }
+  .debug_aranges  0 :  { *(.debug_aranges) }
+  .debug_pubnames  0 :  { *(.debug_pubnames) }
+  .debug_info  0 :  { *(.debug_info) }
+  .debug_abbrev  0 :  { *(.debug_abbrev) }
+  .debug_line  0 :  { *(.debug_line) }
+  .debug_frame  0 :  { *(.debug_frame) }
+  .debug_str  0 :  { *(.debug_str) }
+  .debug_loc  0 :  { *(.debug_loc) }
+  .debug_macinfo  0 :  { *(.debug_macinfo) }
+  .debug_weaknames  0 :  { *(.debug_weaknames) }
+  .debug_funcnames  0 :  { *(.debug_funcnames) }
+  .debug_typenames  0 :  { *(.debug_typenames) }
+  .debug_varnames  0 :  { *(.debug_varnames) }
+
+  .xt.insn 0 :
+  {
+    KEEP (*(.xt.insn))
+    KEEP (*(.gnu.linkonce.x.*))
+  }
+  .xt.prop 0 :
+  {
+    KEEP (*(.xt.prop))
+    KEEP (*(.gnu.linkonce.prop.*))
+  }
+  .xt.lit 0 :
+  {
+    KEEP (*(.xt.lit))
+    KEEP (*(.gnu.linkonce.p.*))
+  }
+}
diff --git a/target_firmware/rom-addrs-k2.ld b/target_firmware/rom-addrs-k2.ld
new file mode 100755
index 0000000..936d4d4
--- /dev/null
+++ b/target_firmware/rom-addrs-k2.ld
@@ -0,0 +1,69 @@
+PROVIDE ( _indir_tbl = 0x00500000 );
+PROVIDE (athos_indirection_table_install = 0x008e1548);
+PROVIDE ( memcpy = 0x008e4eb8 );
+PROVIDE ( memset = 0x008e519c );
+PROVIDE ( __divsi3 = 0x008e4cec );
+PROVIDE ( __udivsi3 = 0x008e4da0 );
+PROVIDE ( __umodsi3 = 0x008e4df0 );
+PROVIDE ( __modsi3 = 0x008e4d54 );
+PROVIDE ( athos_interrupt_init = 0x008e1600 );
+PROVIDE ( athos_unblock_all_intrlvl = 0x008e1460 );
+PROVIDE ( athos_interrupt_handler = 0x008e15f0 );
+PROVIDE ( _xtos_set_interrupt_handler = 0x008e1230 );
+PROVIDE ( hif_module_install = 0x008e2bd4 );
+PROVIDE ( strcmp = 0x008e48b4 );
+PROVIDE ( strlen = 0x008e4a64 );
+PROVIDE ( strcpy = 0x008e49cc );
+PROVIDE ( strncpy = 0x008e4b90 );
+PROVIDE ( Xthal_num_ccompare = 0x004e5869 );
+PROVIDE ( cticks = 0x0050088c );
+PROVIDE ( UsbDeviceDescriptor = 0x004e0100 );
+PROVIDE ( String00Descriptor = 0x004e01a0 );
+PROVIDE ( String10Descriptor = 0x004e01b0 );
+PROVIDE ( String20Descriptor = 0x004e01c0 );
+PROVIDE ( String30Descriptor = 0x004e01e0 );
+PROVIDE ( HIFusb_DescTraceDump = 0x008e2c18 );
+PROVIDE ( xthal_get_intenable = 0x008e4cd4 );
+PROVIDE ( xthal_set_intenable = 0x008e4ce4 );
+PROVIDE ( xthal_get_interrupt = 0x008e4cdc );
+PROVIDE ( xthal_get_ccompare = 0x008e4cc4 );
+PROVIDE ( xthal_set_ccompare = 0x008e4cb4 );
+PROVIDE ( xthal_get_ccount = 0x008e4cac );
+PROVIDE ( Xthal_num_ccompare = 0x004e5869 );
+PROVIDE ( zfDmaReclaimPacket = 0x008e4568 );
+PROVIDE ( zfDmaPutPacket = 0x008e45fc );
+PROVIDE ( zfDmaGetPacket = 0x008e452c );
+PROVIDE ( handle_hp_rx_complete_isr = 0x008e2b18 );
+PROVIDE ( handle_mp_rx_complete_isr = 0x008e2b38 );
+PROVIDE ( handle_tx_complete_isr = 0x008e2adc );
+PROVIDE ( u16TxRxCounter = 0x005009e4 );
+PROVIDE ( pu8DescriptorEX = 0x005009e0 );
+PROVIDE ( fwCheckSum = 0x005009dc );
+PROVIDE ( eUsbCxCommand = 0x005009f0 );
+PROVIDE ( ControlCmd = 0x005009c0 );
+PROVIDE ( eUsbCxFinishAction = 0x005009ec );
+PROVIDE ( UsbChirpFinish = 0x005009f4 );
+PROVIDE ( cmnos_allocram_debug = 0x008e1ae8 );
+PROVIDE ( g_hifUSBCtx = 0x00500978 );
+PROVIDE ( _HIFusb_return_recv_buf = 0x008e2a74 );
+PROVIDE ( vdesc_module_install = 0x008e413c );
+PROVIDE ( vbuf_module_install = 0x008e408c );
+PROVIDE ( mUsbFIFOConfig = 0x008e3ca4 );
+PROVIDE ( mUsbEPMxPtSzHigh = 0x008e3cc4 );
+PROVIDE ( mUsbEPMxPtSzLow = 0x008e3cec );
+PROVIDE ( mUsbEPinHighBandSet = 0x008e3d10 );
+PROVIDE ( mUsbFIFOConfig = 0x008e3ca4 );
+PROVIDE ( mUsbFIFOMap = 0x008e3c84 );
+PROVIDE ( mUsbEPMap = 0x008e3c68 );
+PROVIDE ( usbFifoConf = 0x005009cc );
+PROVIDE ( u8UsbInterfaceValue = 0x005009f8 );
+PROVIDE ( u8UsbConfigValue = 0x005009f6 );
+PROVIDE ( u8UsbInterfaceAlternateSetting = 0x005009fa );
+PROVIDE ( ControlCmd = 0x005009c0 );
+PROVIDE ( vUsbFIFO_EPxCfg_HS = 0x008e3d5c );
+PROVIDE ( vUsbClrEPx = 0x008e2d00 );
+PROVIDE ( bSet_configuration = 0x008e2f7c );
+PROVIDE ( _HIFusb_isr_handler = 0x008e2b58 );
+PROVIDE ( bGet_descriptor = 0x008e2ec4 );
+PROVIDE ( u8ConfigDescriptorEX = 0x005009e8 );
+PROVIDE ( bStandardCommand = 0x008e328c );
diff --git a/target_firmware/rom-addrs-magpie.ld b/target_firmware/rom-addrs-magpie.ld
new file mode 100755
index 0000000..a54a98e
--- /dev/null
+++ b/target_firmware/rom-addrs-magpie.ld
@@ -0,0 +1,74 @@
+PROVIDE ( _indir_tbl = 0x00500000 );
+PROVIDE ( memcpy = 0x008e6b64 );
+PROVIDE ( memset = 0x008e6e48 );
+PROVIDE ( __divsi3 = 0x008e6998 );
+PROVIDE ( __udivsi3 = 0x008e6a4c );
+PROVIDE ( __umodsi3 = 0x008e6a9c );
+PROVIDE ( __modsi3 = 0x008e6a00 );
+PROVIDE ( athos_interrupt_init = 0x008e1614 );
+PROVIDE ( athos_unblock_all_intrlvl = 0x008e1460 );
+PROVIDE ( athos_interrupt_handler = 0x008e1604 );
+PROVIDE ( _xtos_set_interrupt_handler = 0x008e1230 );
+PROVIDE ( generic_hif_module_install = 0x008e1548 );
+PROVIDE ( htc_module_install = 0x008e54a8 );
+PROVIDE ( buf_pool_module_install = 0x008e6264 );
+PROVIDE ( vbuf_module_install = 0x008e4f60 );
+PROVIDE ( vdesc_module_install = 0x008e5010 );
+PROVIDE ( strcmp = 0x008e6560 );
+PROVIDE ( strlen = 0x008e6710 );
+PROVIDE ( strcpy = 0x008e6678 );
+PROVIDE ( strncpy = 0x008e683c );
+PROVIDE ( Xthal_num_ccompare = 0x004e87f9 );
+PROVIDE ( cticks = 0x0050095c );
+PROVIDE ( UsbDeviceDescriptor = 0x004e0100 );
+PROVIDE ( String00Descriptor = 0x004e01a0 );
+PROVIDE ( String10Descriptor = 0x004e01b0 );
+PROVIDE ( String20Descriptor = 0x004e01c0 );
+PROVIDE ( String30Descriptor = 0x004e01e0 );
+PROVIDE ( HIFusb_DescTraceDump = 0x008e37e8 );
+PROVIDE ( xthal_get_intenable = 0x008e6980 );
+PROVIDE ( xthal_set_intenable = 0x008e6990 );
+PROVIDE ( xthal_get_interrupt = 0x008e6988 );
+PROVIDE ( xthal_get_ccompare = 0x008e6970 );
+PROVIDE ( xthal_set_ccompare = 0x008e6960 );
+PROVIDE ( xthal_get_ccount = 0x008e6958 );
+PROVIDE ( Xthal_num_ccompare = 0x004e87f9 );
+PROVIDE ( zfDmaReclaimPacket = 0x008e5d2c );
+PROVIDE ( zfDmaPutPacket = 0x008e5dc0 );
+PROVIDE ( zfDmaGetPacket = 0x008e5cf0 );
+PROVIDE ( fwd_init = 0x008e5e78 );
+PROVIDE ( usbFifoConf = 0x00500aa4 );
+PROVIDE ( _HIFusb_isr_handler = 0x008e36e4 );
+PROVIDE ( mUsbFIFOConfig = 0x008e4934 );
+PROVIDE ( mUsbEPMxPtSzHigh = 0x008e4954 );
+PROVIDE ( mUsbEPMxPtSzLow = 0x008e497c );
+PROVIDE ( mUsbEPinHighBandSet = 0x008e49a0 );
+PROVIDE ( mUsbFIFOConfig = 0x008e4934 );
+PROVIDE ( mUsbFIFOMap = 0x008e4914 );
+PROVIDE ( mUsbEPMap = 0x008e48f8 );
+PROVIDE ( u8UsbInterfaceValue = 0x00500ad0 );
+PROVIDE ( u8UsbConfigValue = 0x00500ace );
+PROVIDE ( u8UsbInterfaceAlternateSetting = 0x00500ad2 );
+PROVIDE ( ControlCmd = 0x00500a98 );
+PROVIDE ( vUsbFIFO_EPxCfg_HS = 0x008e49ec );
+PROVIDE ( vUsbClrEPx = 0x008e38d0 );
+PROVIDE ( bSet_configuration = 0x008e3b54 );
+PROVIDE ( eUsbCxFinishAction = 0x00500ac4 );
+PROVIDE ( pci_sc = 0x00500708 );
+PROVIDE ( __pci_reap_recv = 0x008e31e8 );
+PROVIDE ( __pci_reap_xmitted = 0x008e31bc );
+PROVIDE ( _HIFusb_start = 0x008e34a0 );
+PROVIDE ( g_hifUSBCtx = 0x00500a54 );
+PROVIDE ( _HIFusb_return_recv_buf = 0x008e367c );
+PROVIDE ( athos_indirection_table_install = 0x008e1574 );
+PROVIDE ( u8ConfigDescriptorEX = 0x00500ac0 );
+PROVIDE ( bStandardCommand = 0x008e3e64 );
+PROVIDE ( u16TxRxCounter = 0x00500abc );
+PROVIDE ( pu8DescriptorEX = 0x00500ab8 );
+PROVIDE ( bGet_descriptor = 0x008e3a9c );
+PROVIDE ( _xtos_set_exception_handler = 0x008e6348 );
+PROVIDE (HTCMsgRecvHandler = 0x008e581c);
+PROVIDE (HTCControlSvcProcessMsg = 0x008e56f4);
+PROVIDE (HTCFreeMsgBuffer = 0x008e54ec);
+PROVIDE ( u8UsbDeviceDescriptor = 0x00500ad8 );
+
-- 
1.8.0.2




More information about the ath9k_htc_fw mailing list