altos: Move from newlib-nano to picolibc picolibc
authorKeith Packard <keithp@keithp.com>
Mon, 16 Sep 2019 00:05:17 +0000 (17:05 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 24 Sep 2019 05:46:17 +0000 (22:46 -0700)
Use picolibc.ld, which involved some .ld file hacking, including:

 1) Defining ao_boot RAM address in the .ld file and declaring it 'extern'
 2) Changing how m0 interrupt vector got moved to ram
 3) Using -Taltos.ld instead of -Wl,-Taltos.ld so picolibc.specs wouldn't add picolibc.ld
 4) Placing romconfig vars in '.init.1' and '.init.2' sections instead of '.romconfig'
 5) Place code needing to run out of RAM in section .srodata instead of .ramtext

Signed-off-by: Keith Packard <keithp@keithp.com>
36 files changed:
src/Makefile.defs
src/kernel/ao_product.c
src/lpc/Makefile-flash.defs
src/lpc/Makefile-lpc.defs
src/lpc/Makefile.defs
src/lpc/altos-loader.ld
src/lpc/altos.ld
src/lpc/ao_arch.h
src/lpc/ao_boot_chain.c
src/lpc/ao_interrupt.c
src/micropeak-v2.0/Makefile
src/micropeak-v2.0/micropeak.ld
src/pnpservo-v1/lambda.ld
src/stm/Makefile-flash.defs
src/stm/Makefile-stm.defs
src/stm/Makefile.defs
src/stm/altos-loader.ld
src/stm/altos.ld
src/stm/ao_arch.h
src/stm/ao_boot_chain.c
src/stm/ao_flash_stm.c
src/stm/ao_interrupt.c
src/stm32f4/altos-loader.ld
src/stmf0/Makefile-flash.defs
src/stmf0/Makefile-stmf0.defs
src/stmf0/Makefile.defs
src/stmf0/altos-loader.ld
src/stmf0/altos.ld
src/stmf0/ao_arch.h
src/stmf0/ao_boot_chain.c
src/stmf0/ao_flash_stm.c
src/stmf0/ao_interrupt.c
src/stmf0/ao_storage_stm.c
src/telegps-v1.0/Makefile
src/telegps-v2.0/Makefile
src/telemetrum-v2.0/Makefile

index d52cc7061616fd31d9ccec38339bd5e1e67db91a..db9a445c89336810519a947cbf228034a4e26452 100644 (file)
@@ -20,12 +20,11 @@ WARN_FLAGS=-Wall -Wextra -Werror -Wcast-align \
 
 OPT=-Os
 
-NEWLIB_PRINTF_CFLAGS =         -DNEWLIB_INTEGER_PRINTF_SCANF
+PICOLIBC_PRINTF_CFLAGS =       -DPICOLIBC_INTEGER_PRINTF_SCANF
 
-NEWLIB_CFLAGS= \
-       -ffreestanding -nostdlib \
-       -isystem $(NEWLIB_NANO)/arm-none-eabi/include \
-       $(NEWLIB_PRINTF_CFLAGS)
+PICOLIBC_CFLAGS= \
+       -specs=picolibc.specs \
+       $(PICOLIBC_PRINTF_CFLAGS)
 
 AO_CFLAGS=\
        -std=gnu99 \
index 7248865427b725a60d6544f3e4fbec90bca59511..eaa6c78b8626d3b0070d0d8e811ca9d70aa59352 100644 (file)
@@ -60,8 +60,12 @@ const char ao_product[] = AO_iProduct_STRING;
 #define TOTAL_LENGTH           (HEADER_LEN + AO_USB_HAS_INT * CONTROL_CLASS_LEN + DATA_LEN)
 #define NUM_INTERFACES         (AO_USB_HAS_INT + 1)
 
+#ifndef AO_USBCONFIG_SYMBOL
+#define AO_USBCONFIG_SYMBOL AO_ROMCONFIG_SYMBOL
+#endif
+
 /* USB descriptors in one giant block of bytes */
-AO_ROMCONFIG_SYMBOL uint8_t ao_usb_descriptors [] =
+AO_USBCONFIG_SYMBOL uint8_t ao_usb_descriptors [] =
 {
        /* Device descriptor */
        0x12,
index 44b43bfe94d5f627f6f5bfc3b9f26d7a702eab22..a70b007351b5e88660375b0b55eb8ed47bd3a45b 100644 (file)
@@ -35,7 +35,7 @@ IDPRODUCT=0x000a
 
 CFLAGS = $(PRODUCT_DEF) $(LPC_CFLAGS)
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Wl,-Taltos-loader.ld
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Taltos-loader.ld
 
 PROGNAME=altos-flash
 PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
index 8b2973512ba9d58b2e045631bfb22d90b91c9070..fb3747dd5941e91196596c020a54962b57805aef 100644 (file)
@@ -8,7 +8,7 @@ vpath % $(TOPDIR)/lpc:$(AO_VPATH)
 
 CC=$(ARM_CC)
 
-LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v6-m -lc -lm -lgcc
+LIBS=-lm
 
 LPC_CFLAGS=-mlittle-endian -mcpu=cortex-m0 -mthumb\
-        -I$(TOPDIR)/lpc $(AO_CFLAGS) $(NEWLIB_CFLAGS)
+        -I$(TOPDIR)/lpc $(AO_CFLAGS) $(PICOLIBC_CFLAGS)
index 7fdcf0dc4770a0050e6fbd6c35eb65967a7d7f5a..5c62fa2b437ee2b476631c77e8b7c332e3f6ef95 100644 (file)
@@ -4,7 +4,7 @@ endif
 
 include $(TOPDIR)/lpc/Makefile-lpc.defs
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Wl,-Taltos.ld -n
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/lpc -Taltos.ld -n
 
 ao_serial_lpc.h: $(TOPDIR)/lpc/baud_rate ao_pins.h
        nickle $(TOPDIR)/lpc/baud_rate `awk '/AO_LPC_CLKOUT/{print $$3}' ao_pins.h` > $@
index be4f115d50e76b666307c7efa15baf139138f7c3..547da2db3dd41d7097ab30d4e45793da18e72c01 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom : ORIGIN = 0x00000000, LENGTH = 4K
-       ram : ORIGIN = 0x10000000, LENGTH = 4k - 128 - 32
-       usb (!x) : ORIGIN = 0x20004000 + 2K - 256, LENGTH = 256
-       stack (!w) : ORIGIN = 0x10000000 + 4K - 128 - 32, LENGTH = 128
-}
+__flash = 0x0;
+__flash_size = 4K;
+ao_boot = 0x100000c0;
+__ram = 0x10000000 + 256;
+__ram_size = 4k - 256;
+__stack_size = 128;
 
 INCLUDE registers.ld
-
-EXTERN (lpc_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .interrupt : {
-               __text_start__ = .;
-               *(.interrupt)   /* Interrupt vectors */
-
-       } > rom
-
-       .text ORIGIN(rom) + 0x100 : {
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-
-               *(.text*)       /* Executable code */
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-               *(.rodata*)     /* Constants */
-               __text_end__ = .;
-       } > rom
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot ORIGIN(ram) + SIZEOF(.interrupt) (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot*)
-               __boot_end__ = .;
-       } >ram
-
-       /* Data -- relocated to RAM, but written to ROM
-        */
-       .data : {
-               _start__ = .;
-               *(.data*)       /* initialized data */
-               _end__ = .;
-       } >ram AT>rom
-
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss*)
-               *(COMMON*)
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(__stack__ = ORIGIN(ram) + LENGTH(ram));
-       PROVIDE(end = .);
-}
-
-ENTRY(start);
+INCLUDE picolibc.ld
index 028ad775d28ef579a3f44e99c9d25422f4874001..37b25dc0ff839caff1daa30202f693137b4aecb7 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom (rx) : ORIGIN = 0x00001000, LENGTH = 28K
-       ram (!w) : ORIGIN = 0x10000000, LENGTH = 4K - 128
-       usb (!x) : ORIGIN = 0x20004000 + 2K - 256, LENGTH = 256
-       stack (!w) : ORIGIN = 0x10000000 + 4K - 128, LENGTH = 128
-}
+__flash = 0x1000;
+__flash_size = 28K;
+__interrupt_start = 0x10000000;
+ao_boot = 0x100000c0;
+__ram = 0x10000000 + 256;
+__ram_size = 4k - 256;
+__stack_size = 128;
 
 INCLUDE registers.ld
-
-EXTERN (lpc_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) {
-               __interrupt_start__ = .;
-               __interrupt_rom__ = ORIGIN(rom);
-               *(.interrupt)   /* Interrupt vectors */
-               __interrupt_end__ = .;
-       } > ram
-
-       .text ORIGIN(rom) + 0x100 : {
-               __text_start__ = .;
-
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-
-               *(.text*)       /* Executable code */
-               *(.rodata*)     /* Constants */
-
-       } > rom
-
-       .ARM.exidx : {
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-               __text_end__ = .;
-       } > rom
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot : {
-               __boot_start__ = .;
-               *(.boot)
-               . = ALIGN(4);
-               __boot_end__ = .;
-       } >ram
-
-       /* Data -- relocated to RAM, but written to ROM
-        */
-       .data : AT (ADDR(.ARM.exidx) + SIZEOF (.ARM.exidx)) {
-               _start__ = .;
-               *(.data)        /* initialized data */
-               _end__ = .;
-               __bss_start__ = .;
-       } >ram
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               __bss_end__ = .;
-       } >ram
-       PROVIDE(end = .);
-
-       PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack));
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index 93676b860ff6c9edfb79804805307f288fd67c75..c638aa22b9658846a0a4319daec94b377706b6d4 100644 (file)
@@ -53,7 +53,8 @@
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".init.1"))) const
+#define AO_USBCONFIG_SYMBOL __attribute__((section(".init.2"))) const
 
 #define ao_arch_block_interrupts()     asm("cpsid i")
 #define ao_arch_release_interrupts()   asm("cpsie i")
index 0d0bb91c75f3c5f05bff78cc4025780ebca4c054..dc3ecff8c107414971a819b624642a48deefe9bc 100644 (file)
@@ -43,7 +43,7 @@ struct ao_boot {
        uint32_t        check;
 };
 
-static struct ao_boot __attribute__ ((section(".boot"))) ao_boot;
+extern struct ao_boot ao_boot;
 
 int
 ao_boot_check_chain(void)
index 8d71f43f2de38c1f0216d17d18d14b02e82e9559..f2c16806741beb724e8b2ca4ac18c2c10c232b25 100644 (file)
 #define RELOCATE_INTERRUPT     1
 #endif
 
-extern void main(void);
-extern char __stack__;
-extern char __text_start__, __text_end__;
-extern char _start__, _end__;
-extern char __bss_start__, __bss_end__;
-#if RELOCATE_INTERRUPT
-extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__;
-#endif
-
 /* Interrupt functions */
 
 void lpc_halt_isr(void)
@@ -49,23 +40,6 @@ void lpc_ignore_isr(void)
 {
 }
 
-void start(void) {
-#ifdef AO_BOOT_CHAIN
-       if (ao_boot_check_chain()) {
-#ifdef AO_BOOT_PIN
-               ao_boot_check_pin();
-#endif
-       }
-#endif
-#if RELOCATE_INTERRUPT
-       memcpy(&__interrupt_start__, &__interrupt_rom__, &__interrupt_end__ - &__interrupt_start__);
-       lpc_scb.sysmemremap = LPC_SCB_SYSMEMREMAP_MAP_RAM << LPC_SCB_SYSMEMREMAP_MAP;
-#endif
-       memcpy(&_start__, &__text_end__, &_end__ - &_start__);
-       memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
-       main();
-}
-
 #define STRINGIFY(x) #x
 
 #define isr(name) \
@@ -119,10 +93,13 @@ isr(usb_wakeup)
 #define i(addr,name)   [(addr)/4] = lpc_ ## name ## _isr
 #define c(addr,value)  [(addr)/4] = (value)
 
-__attribute__ ((section(".interrupt")))
-const void *lpc_interrupt_vector[] = {
-       [0] = &__stack__,
-       [1] = start,
+extern char __stack[];
+extern void _start(void);
+
+__attribute__ ((section(".init")))
+const void *const lpc_interrupt_vector[0x40] = {
+       [0] = __stack,
+       [1] = _start,
        i(0x08, nmi),
        i(0x0c, hardfault),
        c(0x10, 0),
@@ -175,3 +152,24 @@ const void *lpc_interrupt_vector[] = {
        i(0xb8, usb_wakeup),
        i(0xbc, hardfault),
 };
+
+extern char __interrupt_start[];
+
+void _init(void);
+
+void _init(void)
+{
+#ifdef AO_BOOT_CHAIN
+       if (ao_boot_check_chain()) {
+#ifdef AO_BOOT_PIN
+               ao_boot_check_pin();
+#endif
+       }
+#endif
+#if RELOCATE_INTERRUPT
+       /* This will erase the boot chain data */
+       memcpy(__interrupt_start, lpc_interrupt_vector, sizeof (lpc_interrupt_vector));
+       lpc_scb.sysmemremap = LPC_SCB_SYSMEMREMAP_MAP_RAM << LPC_SCB_SYSMEMREMAP_MAP;
+#endif
+}
+
index f1f57440a89c30f8ad42409c1fdaaac04fa1b096..37e1d2b79ac0f92be2dae0c50423833876a4d217 100644 (file)
@@ -71,10 +71,10 @@ OBJ=$(SRC:.c=.o)
 
 all: $(PROG) $(HEX)
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Tmicropeak.ld -n
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Tmicropeak.ld -n
 
 $(PROG): Makefile $(OBJ) micropeak.ld
-       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map
 
 distclean:     clean
 
index a73d4c1d3dbff1b1607550e964c985908583fa0c..cee1b4b67173335fcf73fb32a96fbbce0a410725 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom (rx) :   ORIGIN = 0x08001000, LENGTH = 20K
-       flash(rx) :  ORIGIN = 0x08006000, LENGTH = 8K
-       ram (!w) :   ORIGIN = 0x20000000, LENGTH = 6k - 512
-       stack (!w) : ORIGIN = 0x20000000 + 6k - 512, LENGTH = 512
-}
+__flash = 0x08001000;
+__flash_size = 22K;
+__flash__ = __flash + __flash_size;
+__flash_end__ = __flash__ + 6K;
+__interrupt_start = 0x20000000;
+ao_boot = 0x200000c0;
+__ram = 0x20000000 + 256;
+__ram_size = 6K - 256;
+__stack_size = 512;
 
 INCLUDE registers.ld
-
-EXTERN (stm_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) {
-               __interrupt_start__ = .;
-               __interrupt_rom__ = ORIGIN(rom);
-               *(.interrupt)   /* Interrupt vectors */
-               __interrupt_end__ = .;
-       } > ram
-
-       .text ORIGIN(rom) + 0x100 : {
-               __text_start__ = .;
-
-               /* Ick. What I want is to specify the
-                * addresses of some global constants so
-                * that I can find them across versions
-                * of the application. I can't figure out
-                * how to make gnu ld do that, so instead
-                * we just load the two files that include
-                * these defines in the right order here and
-                * expect things to 'just work'. Don't change
-                * the contents of those files, ok?
-                */
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-
-               *(.text*)       /* Executable code */
-       } > rom
-
-       .ARM.exidx : {
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-       } > rom
-
-       .rodata : {
-               *(.rodata*)     /* Constants */
-       } > rom
-
-       __text_end__ = .;
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot)
-               . = ALIGN(4);
-               __boot_end__ = .;
-       } >ram
-
-       /* Functions placed in RAM (required for flashing)
-        *
-        * Align to 8 bytes as that's what the ARM likes text
-        * segment alignments to be, and if we don't, then
-        * we end up with a mismatch between the location in
-        * ROM and the desired location in RAM. I don't
-        * entirely understand this, but at least this appears
-        * to work...
-        */
-
-       .textram BLOCK(8): {
-               _start__ = .;
-               *(.ramtext)
-       } >ram AT>rom
-
-       /* Data -- relocated to RAM, but written to ROM,
-        * also aligned to 8 bytes to agree with textram
-        */
-       .data BLOCK(8): {
-               *(.data)        /* initialized data */
-               _end__ = .;
-       } >ram AT>rom
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               . = ALIGN(4);
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(end = .);
-
-       PROVIDE(__flash__ = ORIGIN(flash));
-       PROVIDE(__flash_end__ = ORIGIN(flash) + LENGTH(flash));
-
-       PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack));
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index d3edbe9fb2168ed9eefd93ace5795bdd439382b6..20b3ace79be0df292ec4e771f6bc39abab6b9443 100644 (file)
@@ -87,7 +87,7 @@ SECTIONS {
        .textram BLOCK(8): {
                _start__ = .;
                __text_ram_start__ = .;
-               *(.ramtext)
+               *(.srodata)
                __text_ram_end = .;
        } >ram AT>rom
 
index 08a4b1773e00be742ac16856a883402d7e4f16b3..a02be9c198c8b349dd764401bc5a121c910e5b05 100644 (file)
@@ -35,13 +35,13 @@ IDPRODUCT=0x000a
 
 CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS)
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos-loader.ld -n
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Taltos-loader.ld -n
 
 PROGNAME=altos-flash
 PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
-       $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
 $(OBJ): $(INC)
 
index cce28f009f86f648d907489ff483e3ffe522206a..f3fd9de65ee1f8916b56e3b346bd48540b6aef0a 100644 (file)
@@ -7,7 +7,7 @@ include $(TOPDIR)/Makefile.defs
 vpath % $(TOPDIR)/stm:$(AO_VPATH)
 
 CC=$(ARM_CC)
-LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v7-m -lm -lc -lgcc
+LIBS=-lm
 
 STM_CFLAGS=-mlittle-endian -mcpu=cortex-m3 -mthumb \
-       -I$(TOPDIR)/stm $(AO_CFLAGS) $(NEWLIB_CFLAGS)
+       -I$(TOPDIR)/stm $(AO_CFLAGS) $(PICOLIBC_CFLAGS)
index 26ba582404fa4cd99b74701e71487970f99788ea..2ed89f7e3c4ee56b5fdebb37329c4f6fa815bf3c 100644 (file)
@@ -4,4 +4,4 @@ endif
 
 include $(TOPDIR)/stm/Makefile-stm.defs
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Wl,-Taltos.ld -n
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stm -Taltos.ld -n
index 1ebbc7a2afcb15b30d2c24fe692547edec4e1073..756babf5e7366cc6df1fc801da2d8ddb84351009 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom : ORIGIN = 0x08000000, LENGTH = 4K
-       ram : ORIGIN = 0x20000000, LENGTH = 16K
-}
+__flash = 0x08000000;
+__flash_size = 4K;
+ao_boot = 0x100000c0;
+__ram =   0x10000000 + 256;
+__ram_size = 16K - 256;
+__stack_size = 512;
 
 INCLUDE registers.ld
-
-EXTERN (stm_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .text : {
-               __text_start__ = .;
-               *(.interrupt)   /* Interrupt vectors */
-
-               . = ORIGIN(rom) + 0x100;
-
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-               *(.text*)       /* Executable code */
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-               *(.rodata*)     /* Constants */
-       } > rom
-       __text_end__ = .;
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot)
-               __boot_end__ = .;
-       } >ram
-
-       /* Functions placed in RAM (required for flashing)
-        *
-        * Align to 8 bytes as that's what the ARM likes text
-        * segment alignments to be, and if we don't, then
-        * we end up with a mismatch between the location in
-        * ROM and the desired location in RAM. I don't
-        * entirely understand this, but at least this appears
-        * to work...
-        */
-
-       .textram BLOCK(8): {
-               _start__ = .;
-               __text_ram_start__ = .;
-               *(.ramtext)
-               __text_ram_end = .;
-       } >ram AT>rom
-
-       /* Data -- relocated to RAM, but written to ROM
-        * Also aligned to 8 bytes to agree with textram
-        */
-       .data BLOCK(8): {
-               *(.data)        /* initialized data */
-               _end__ = .;
-       } >ram AT>rom
-
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(__stack__ = ORIGIN(ram) + LENGTH(ram));
-       PROVIDE(end = .);
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index e352ed36601d85409801dc8c605a8a49a07536e7..fb142df6b9c8b65606bee686b9570fcb818ea20a 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom (rx) : ORIGIN = 0x08001000, LENGTH = 124K
-       ram (!w) : ORIGIN = 0x20000000, LENGTH = 15872
-       stack (!w) : ORIGIN = 0x20003e00, LENGTH = 512
-}
+__flash = 0x08001000;
+__flash_size = 124K;
+ao_boot = 0x20000000;
+/* just past ao_boot */
+__ram = 0x2000000c;
+/* leave out ao_boot */
+__ram_size = 16k - 12;
+__stack_size = 512;
 
 INCLUDE registers.ld
-
-EXTERN (stm_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .text ORIGIN(rom) : {
-               __text_start__ = .;
-               *(.interrupt)   /* Interrupt vectors */
-
-               . = ORIGIN(rom) + 0x100;
-
-
-               /* Ick. What I want is to specify the
-                * addresses of some global constants so
-                * that I can find them across versions
-                * of the application. I can't figure out
-                * how to make gnu ld do that, so instead
-                * we just load the two files that include
-                * these defines in the right order here and
-                * expect things to 'just work'. Don't change
-                * the contents of those files, ok?
-                */
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-               *(.text*)       /* Executable code */
-               *(.rodata*)     /* Constants */
-
-       } > rom
-
-       .ARM.exidx : {
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-       } > rom
-       __text_end__ = .;
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot)
-               . = ALIGN(4);
-               __boot_end__ = .;
-       } >ram
-
-       /* Data -- relocated to RAM, but written to ROM
-        */
-       .data : {
-               _start__ = .;
-               *(.data)        /* initialized data */
-               . = ALIGN(4);
-               _end__ = .;
-       } >ram AT>rom
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               . = ALIGN(4);
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(end = .);
-
-       PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack));
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index e83b6bd2cfbf3e1dac4a7c2816703fcf1214ba08..e3094c6abec04fdcc4a700d5d216639995beb7b2 100644 (file)
@@ -51,7 +51,8 @@
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".init.1"))) const
+#define AO_USBCONFIG_SYMBOL __attribute__((section(".init.2"))) const
 
 /*
  * For now, we're running at a weird frequency
index 488af1e1b8dffc2261e303aa3b3981b3a69f29f7..5834827bb051974ee65c1a248ba890f62062a4bd 100644 (file)
@@ -43,8 +43,8 @@ struct ao_boot {
        uint32_t        check;
 };
 
-static struct ao_boot __attribute__ ((section(".boot"))) ao_boot;
-       
+extern struct ao_boot ao_boot;
+
 int
 ao_boot_check_chain(void)
 {
index 38618bbe53165f64138c0a3a39fa81c2740cbf20..3dcbaea677ceca587b54c0482c2c7c789ea10565 100644 (file)
@@ -70,7 +70,7 @@ ao_flash_wait_bsy(void)
                ;
 }
 
-static void __attribute__ ((section(".ramtext"),noinline))
+static void __attribute__ ((section(".srodata"),noinline))
 _ao_flash_erase_page(uint32_t *page)
 {
        stm_flash.pecr |= (1 << STM_FLASH_PECR_ERASE) | (1 << STM_FLASH_PECR_PROG);
@@ -93,7 +93,7 @@ ao_flash_erase_page(uint32_t *page)
        ao_arch_release_interrupts();
 }
 
-static void __attribute__ ((section(".ramtext"), noinline))
+static void __attribute__ ((section(".srodata"), noinline))
 _ao_flash_half_page(uint32_t *dst, uint32_t *src)
 {
        uint8_t         i;
index d8be36670baf608726adfa910b9aa70e4b31d5ed..5738014ed375c47ba703c994d9832bfc0f1721c1 100644 (file)
 #include <ao_boot.h>
 
 extern void main(void);
-extern char __stack__;
-extern char __text_start__, __text_end__;
-extern char _start__, _end__;
-extern char __bss_start__, __bss_end__;
 
 /* Interrupt functions */
 
@@ -38,7 +34,7 @@ void stm_ignore_isr(void)
 {
 }
 
-const void *stm_interrupt_vector[];
+void *const stm_interrupt_vector[];
 
 uint32_t
 stm_flash_size(void) {
@@ -72,8 +68,11 @@ stm_flash_size(void) {
        return (uint32_t) kbytes * 1024;
 }
 
-void start(void)
-{
+extern char __stack[];
+
+void _init(void);
+
+void _init(void) {
 #ifdef AO_BOOT_CHAIN
        if (ao_boot_check_chain()) {
 #ifdef AO_BOOT_PIN
@@ -83,9 +82,6 @@ void start(void)
 #endif
        /* Set interrupt vector table offset */
        stm_nvic.vto = (uint32_t) &stm_interrupt_vector;
-       memcpy(&_start__, &__text_end__, &_end__ - &_start__);
-       memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
-       main();
 }
 
 #define STRINGIFY(x) #x
@@ -155,10 +151,16 @@ isr(tim7)
 
 #define i(addr,name)   [(addr)/4] = stm_ ## name ## _isr
 
-__attribute__ ((section(".interrupt")))
-const void *stm_interrupt_vector[] = {
-       [0] = &__stack__,
-       [1] = start,
+extern void _start(void);
+
+/* This must be exactly 256 bytes long so that the configuration data
+ * gets loaded at the right place
+ */
+
+__attribute__ ((section(".init")))
+void * const stm_interrupt_vector[64] = {
+       [0] = &__stack,
+       [1] = _start,
        i(0x08, nmi),
        i(0x0c, hardfault),
        i(0x10, memmanage),
index 5d6e1f4b14006ff037e2c988f564681c05cf4ab1..9a46987fa33969bb1b2ab3cc7bac742e02581da2 100644 (file)
@@ -68,7 +68,7 @@ SECTIONS {
        .textram BLOCK(8): {
                _start__ = .;
                __text_ram_start__ = .;
-               *(.ramtext)
+               *(.srodata)
                __text_ram_end = .;
        } >ram AT>rom
 
index b6e44990b5a0f1fbd88ff98934d10855a48cb39b..eec4c568c85fd30434e5fb8f54866a381728ae44 100644 (file)
@@ -35,7 +35,7 @@ IDPRODUCT=0x000a
 
 CFLAGS = $(PRODUCT_DEF) $(STMF0_CFLAGS)
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos-loader.ld
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Taltos-loader.ld
 
 PROGNAME=altos-flash
 PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
@@ -47,7 +47,7 @@ FLASH_ADDR=0x08000000
 all: $(PROG) $(BIN)
 
 $(PROG): Makefile $(OBJ) altos-loader.ld
-       $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
 
 $(BIN): $(PROG)
        $(MAKEBIN) --output=$@ --base=$(FLASH_ADDR) $(PROG)
index 5a883adf1345bdd72593ca23f50321ba5068f4b8..f3add106902fc6dca051d79da3663c30f149f7cd 100644 (file)
@@ -9,6 +9,6 @@ vpath % $(TOPDIR)/stmf0:$(AO_VPATH)
 CC=$(ARM_CC)
 
 STMF0_CFLAGS=-mlittle-endian -mcpu=cortex-m0 -mthumb\
-       -I$(TOPDIR)/stmf0 $(AO_CFLAGS) $(NEWLIB_CFLAGS)
+       -I$(TOPDIR)/stmf0 $(AO_CFLAGS) $(PICOLIBC_CFLAGS)
 
-LIBS=-L$(NEWLIB_NANO)/arm-none-eabi/lib/thumb/v6-m -lc -lm -lgcc
+LIBS=-lm
index 2baba4f2b3536360cb03933929fd825c62c9d425..ffce32572f7c2a25804659c867ae9dbb37c91b19 100644 (file)
@@ -4,7 +4,7 @@ endif
 
 include $(TOPDIR)/stmf0/Makefile-stmf0.defs
 
-LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Wl,-Taltos.ld -n
+LDFLAGS=$(CFLAGS) -L$(TOPDIR)/stmf0 -Taltos.ld -n
 
 LOADER=flash-loader/$(PROGNAME)-altos-flash-$(VERSION).elf
 MAKEBIN=$(TOPDIR)/../ao-tools/ao-makebin/ao-makebin
index 4d9b81ae0ad16d0121b8d79ee75638c994b6b618..2f3bd383d94e0d66ad4c4d85c78196f406c4f331 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom : ORIGIN = 0x08000000, LENGTH = 4K
-       ram : ORIGIN = 0x20000000, LENGTH = 6K
-}
+__flash = 0x08000000;
+__flash_size = 4K;
+ao_boot = 0x200000c0;
+__ram = 0x20000000 + 256;
+__ram_size = 6k - 256;
+__stack_size = 128;
 
 INCLUDE registers.ld
-
-EXTERN (stm_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .interrupt : {
-               __text_start__ = .;
-               *(.interrupt)   /* Interrupt vectors */
-       } > rom
-
-       .text ORIGIN(rom) + 0x100 : {
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-
-               *(.text*)       /* Executable code */
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-               *(.rodata*)     /* Constants */
-       } > rom
-       __text_end__ = .;
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot ORIGIN(ram) + SIZEOF(.interrupt) (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot)
-               __boot_end__ = .;
-       } >ram
-
-       /* Functions placed in RAM (required for flashing)
-        *
-        * Align to 8 bytes as that's what the ARM likes text
-        * segment alignments to be, and if we don't, then
-        * we end up with a mismatch between the location in
-        * ROM and the desired location in RAM. I don't
-        * entirely understand this, but at least this appears
-        * to work...
-        */
-
-       .textram BLOCK(8): {
-               _start__ = .;
-               __text_ram_start__ = .;
-               *(.ramtext)
-               __text_ram_end = .;
-       } >ram AT>rom
-
-       /* Data -- relocated to RAM, but written to ROM.
-        * also aligned to 8 bytes in case textram is empty
-        */
-       .data BLOCK(8): {
-               *(.data)        /* initialized data */
-               _end__ = .;
-       } >ram AT>rom
-
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(__stack__ = ORIGIN(ram) + LENGTH(ram));
-       PROVIDE(end = .);
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index 64e1d00cf0ab5b1aadebebdd389914a1d8d63c5e..19f257ea79ac6c36ef80303aa280d95f498f4d89 100644 (file)
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-MEMORY {
-       rom (rx) :   ORIGIN = 0x08001000, LENGTH = 28K
-       ram (!w) :   ORIGIN = 0x20000000, LENGTH = 6k - 128
-       stack (!w) : ORIGIN = 0x20000000 + 6k - 128, LENGTH = 128
-}
+__flash = 0x08001000;
+__flash_size = 28K;
+__interrupt_start = 0x20000000;
+ao_boot = 0x200000c0;
+__ram = 0x20000000 + 256;
+__ram_size = 6k - 256;
+__stack_size = 128;
 
 INCLUDE registers.ld
-
-EXTERN (stm_interrupt_vector)
-
-SECTIONS {
-       /*
-        * Rom contents
-        */
-
-       .interrupt ORIGIN(ram) : AT (ORIGIN(rom)) {
-               __interrupt_start__ = .;
-               __interrupt_rom__ = ORIGIN(rom);
-               *(.interrupt)   /* Interrupt vectors */
-               __interrupt_end__ = .;
-       } > ram
-
-       .text ORIGIN(rom) + 0x100 : {
-               __text_start__ = .;
-
-               /* Ick. What I want is to specify the
-                * addresses of some global constants so
-                * that I can find them across versions
-                * of the application. I can't figure out
-                * how to make gnu ld do that, so instead
-                * we just load the two files that include
-                * these defines in the right order here and
-                * expect things to 'just work'. Don't change
-                * the contents of those files, ok?
-                */
-               ao_romconfig.o(.romconfig*)
-               ao_product.o(.romconfig*)
-
-               *(.text*)       /* Executable code */
-       } > rom
-
-       .ARM.exidx : {
-               *(.ARM.exidx* .gnu.linkonce.armexidx.*)
-       } > rom
-
-       .rodata : {
-               *(.rodata*)     /* Constants */
-       } > rom
-
-       __text_end__ = .;
-
-       /* Boot data which must live at the start of ram so that
-        * the application and bootloader share the same addresses.
-        * This must be all uninitialized data
-        */
-       .boot (NOLOAD) : {
-               __boot_start__ = .;
-               *(.boot)
-               . = ALIGN(4);
-               __boot_end__ = .;
-       } >ram
-
-       /* Data -- relocated to RAM, but written to ROM
-        */
-       .data : {
-               _start__ = .;
-               *(.data)        /* initialized data */
-               . = ALIGN(4);
-               _end__ = .;
-       } >ram AT>rom
-
-       .bss : {
-               __bss_start__ = .;
-               *(.bss)
-               *(COMMON)
-               . = ALIGN(4);
-               __bss_end__ = .;
-       } >ram
-
-       PROVIDE(end = .);
-
-       PROVIDE(__stack__ = ORIGIN(stack) + LENGTH(stack));
-}
-
-ENTRY(start);
-
-
+INCLUDE picolibc.ld
index d70a9110e91fa02ac481ced1e928fa1868b0ca6d..47ac72787aa1801bbd3f56dc891efa0c8402ce44 100644 (file)
@@ -53,7 +53,8 @@
  * ao_romconfig.c
  */
 
-#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const
+#define AO_ROMCONFIG_SYMBOL __attribute__((section(".init.1"))) const
+#define AO_USBCONFIG_SYMBOL __attribute__((section(".init.2"))) const
 
 extern const uint16_t ao_romconfig_version;
 extern const uint16_t ao_romconfig_check;
index 8f850a0a6d98d7ee1b0484f746dd8f6453e19d43..5834827bb051974ee65c1a248ba890f62062a4bd 100644 (file)
@@ -43,7 +43,7 @@ struct ao_boot {
        uint32_t        check;
 };
 
-static struct ao_boot __attribute__ ((section(".boot"))) ao_boot;
+extern struct ao_boot ao_boot;
 
 int
 ao_boot_check_chain(void)
index 2d57eea72701eefeae6e61ad0a6fc0395cf2dac7..1445950c0f3b0b5cc6fdf63a3cde6bd9ab6b8c90 100644 (file)
@@ -52,7 +52,7 @@ ao_flash_lock(void)
 
 #define ao_flash_wait_bsy() do { while (stm_flash.sr & (1 << STM_FLASH_SR_BSY)); } while (0)
 
-static void __attribute__ ((section(".ramtext"),noinline))
+static void __attribute__ ((section(".srodata"),noinline))
 _ao_flash_erase_page(uint32_t *page)
 {
        stm_flash.cr |= (1 << STM_FLASH_CR_PER);
@@ -103,7 +103,7 @@ ao_flash_erase_page(uint32_t *page)
        ao_arch_release_interrupts();
 }
 
-static void __attribute__ ((section(".ramtext"), noinline))
+static void __attribute__ ((section(".srodata"), noinline))
 _ao_flash_page(uint16_t *dst, uint16_t *src)
 {
        uint8_t         i;
index 0025de47153445bbf6d5df961c54726dab0d4c23..1e6c717face88b8e3513d30ccd933d7afe02a14d 100644 (file)
 #endif
 #endif
 
-extern void main(void);
-extern char __stack__;
-extern char __text_start__, __text_end__;
-extern char _start__, _end__;
-extern char __bss_start__, __bss_end__;
-#if RELOCATE_INTERRUPT
-extern char __interrupt_rom__, __interrupt_start__, __interrupt_end__;
-#endif
-
 /* Interrupt functions */
 
 void stm_halt_isr(void)
@@ -52,8 +43,6 @@ void stm_ignore_isr(void)
 {
 }
 
-const void *stm_interrupt_vector[];
-
 uint32_t
 stm_flash_size(void) {
        uint16_t        dev_id = stm_dev_id();
@@ -67,32 +56,6 @@ stm_flash_size(void) {
        return (uint32_t) kbytes * 1024;
 }
 
-void start(void)
-{
-#if AO_BOOT_CHAIN
-       if (ao_boot_check_chain()) {
-#if AO_BOOT_PIN
-               ao_boot_check_pin();
-#endif
-       }
-#endif
-       /* Turn on syscfg */
-       stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGCOMPEN);
-
-#if RELOCATE_INTERRUPT
-       memcpy(&__interrupt_start__, &__interrupt_rom__, &__interrupt_end__ - &__interrupt_start__);
-       stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) |
-               (STM_SYSCFG_CFGR1_MEM_MODE_SRAM << STM_SYSCFG_CFGR1_MEM_MODE);
-#else
-       /* Switch to Main Flash mode (DFU loader leaves us in System mode) */
-       stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) |
-               (STM_SYSCFG_CFGR1_MEM_MODE_MAIN_FLASH << STM_SYSCFG_CFGR1_MEM_MODE);
-#endif
-       memcpy(&_start__, &__text_end__, &_end__ - &_start__);
-       memset(&__bss_start__, '\0', &__bss_end__ - &__bss_start__);
-       main();
-}
-
 #define STRINGIFY(x) #x
 
 #define isr(name) \
@@ -150,10 +113,13 @@ isr(usb)
 
 #define i(addr,name)   [(addr)/4] = stm_ ## name ## _isr
 
-__attribute__ ((section(".interrupt")))
-const void *stm_interrupt_vector[] = {
-       [0] = &__stack__,
-       [1] = start,
+extern char __stack[];
+void _start(void);
+
+__attribute__ ((section(".init")))
+const void * const stm_interrupt_vector[] = {
+       [0] = __stack,
+       [1] = _start,
        i(0x08, nmi),
        i(0x0c, hardfault),
        i(0x2c, svc),
@@ -193,3 +159,33 @@ const void *stm_interrupt_vector[] = {
        i(0xb8, cec_can),
        i(0xbc, usb),
 };
+
+void _init(void);
+
+#if RELOCATE_INTERRUPT
+extern char __interrupt_start[];
+#endif
+
+void _init(void)
+{
+#if AO_BOOT_CHAIN
+       if (ao_boot_check_chain()) {
+#if AO_BOOT_PIN
+               ao_boot_check_pin();
+#endif
+       }
+#endif
+       /* Turn on syscfg */
+       stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGCOMPEN);
+
+#if RELOCATE_INTERRUPT
+       /* This will erase the boot chain data */
+       memcpy(&__interrupt_start, stm_interrupt_vector, sizeof (stm_interrupt_vector));
+       stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) |
+               (STM_SYSCFG_CFGR1_MEM_MODE_SRAM << STM_SYSCFG_CFGR1_MEM_MODE);
+#else
+       /* Switch to Main Flash mode (DFU loader leaves us in System mode) */
+       stm_syscfg.cfgr1 = (stm_syscfg.cfgr1 & ~(STM_SYSCFG_CFGR1_MEM_MODE_MASK << STM_SYSCFG_CFGR1_MEM_MODE)) |
+               (STM_SYSCFG_CFGR1_MEM_MODE_MAIN_FLASH << STM_SYSCFG_CFGR1_MEM_MODE);
+#endif
+}
index c6f1defe8e67b3f8efe97a3424804e9eac470126..0819350e8f9eb758a854196568ee0eb631c589a5 100644 (file)
@@ -70,7 +70,7 @@ stm_flash_page_size(void)
 
 #define ao_flash_wait_bsy() do { while (stm_flash.sr & (1 << STM_FLASH_SR_BSY)); } while (0)
 
-static void __attribute__ ((section(".ramtext"),noinline))
+static void __attribute__ ((section(".srodata"),noinline))
 _ao_flash_erase_page(uint16_t *page)
 {
        stm_flash.cr |= (1 << STM_FLASH_CR_PER);
@@ -86,7 +86,7 @@ _ao_flash_erase_page(uint16_t *page)
 
 #define _ao_flash_addr(pos)    ((uint16_t *) (void *) ((uint8_t *) __flash__ + (pos)))
 
-static void __attribute ((section(".ramtext"), noinline)) _ao_flash_byte(uint32_t pos, uint8_t b)
+static void __attribute ((section(".srodata"), noinline)) _ao_flash_byte(uint32_t pos, uint8_t b)
 {
        uint16_t        v;
        uint16_t        *a = _ao_flash_addr(pos & ~1);
@@ -99,7 +99,7 @@ static void __attribute ((section(".ramtext"), noinline)) _ao_flash_byte(uint32_
        ao_flash_wait_bsy();
 }
 
-static void __attribute__ ((section(".ramtext"), noinline))
+static void __attribute__ ((section(".srodata"), noinline))
 _ao_flash_write(uint32_t pos, void *sv, uint16_t len)
 {
        uint8_t         *s = sv;
index fc1b1f28c8de9396a72e1fd38ea69bd9bb95b23b..aa644298a2f11cca28c35d339e9492b87ce64c3a 100644 (file)
@@ -71,7 +71,7 @@ OBJ=$(SRC:.c=.o)
 all: $(PROG) $(HEX)
 
 $(PROG): Makefile $(OBJ) altos.ld
-       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map
 
 $(OBJ): $(INC)
 
index 7ce2847154b4483e433f4c26504af8dcad00af3d..24410e0d375403c771b8b43c321b61404d133494 100644 (file)
@@ -73,7 +73,7 @@ OBJ=$(SRC:.c=.o)
 all: $(PROG) $(HEX)
 
 $(PROG): Makefile $(OBJ) altos.ld
-       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map
 
 $(OBJ): $(INC)
 
index c1e220e3df54ca7a10edab50cc5c25a5c794c974..9b66c5180407eb08a921d4a4f06b5d8750222699 100644 (file)
@@ -105,7 +105,7 @@ OBJ=$(SRC:.c=.o)
 all: $(PROG) $(HEX)
 
 $(PROG): Makefile $(OBJ) altos.ld
-       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS)
+       $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) -Wl,-Map=$(PROGNAME)-$(VERSION).map
 
 $(OBJ): $(INC)