From: Keith Packard Date: Sun, 6 Nov 2022 04:05:13 +0000 (-0700) Subject: samd21: Configure ROM/RAM values per device and provide linker scripts for each X-Git-Tag: 1.9.13~1^2~26^2~50 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=13a9247afabfaf93ebf46f9a33862864d2772074 samd21: Configure ROM/RAM values per device and provide linker scripts for each SAMD21 has 4-32k of RAM and 32-256K of ROM Signed-off-by: Keith Packard --- diff --git a/src/samd21/Makefile.defs b/src/samd21/Makefile.defs index eb6a267d..d58db934 100644 --- a/src/samd21/Makefile.defs +++ b/src/samd21/Makefile.defs @@ -4,6 +4,8 @@ endif include $(TOPDIR)/samd21/Makefile-samd21.defs -LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/samd21 -Taltos.ld -n +SAMD21_LINKER_SCRIPT=altos-$(SAMD21_ROM)-$(SAMD21_RAM).ld + +LDFLAGS=-nostartfiles $(CFLAGS) -L$(TOPDIR)/samd21 -T$(SAMD21_LINKER_SCRIPT) -n .DEFAULT_GOAL=all diff --git a/src/samd21/altos-128-16.ld b/src/samd21/altos-128-16.ld new file mode 100644 index 00000000..e07a6a4e --- /dev/null +++ b/src/samd21/altos-128-16.ld @@ -0,0 +1,26 @@ +/* + * Copyright © 2022 Keith Packard + * + * 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 of the License, 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; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +__flash = 0x00001000; +__flash_size = 128K - 4K; +__ram = 0x20000000; +__ram_size = 16k; +__stack_size = 256; + +INCLUDE registers.ld +INCLUDE picolibc.ld diff --git a/src/samd21/altos-256-32.ld b/src/samd21/altos-256-32.ld new file mode 100644 index 00000000..4be7d676 --- /dev/null +++ b/src/samd21/altos-256-32.ld @@ -0,0 +1,26 @@ +/* + * Copyright © 2022 Keith Packard + * + * 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 of the License, 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; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +__flash = 0x00001000; +__flash_size = 256 - 4K; +__ram = 0x20000000; +__ram_size = 32k; +__stack_size = 256; + +INCLUDE registers.ld +INCLUDE picolibc.ld diff --git a/src/samd21/altos-loader.ld b/src/samd21/altos-loader.ld index 7715aa50..a06d28b2 100644 --- a/src/samd21/altos-loader.ld +++ b/src/samd21/altos-loader.ld @@ -19,7 +19,7 @@ __flash = 0x00000000; __flash_size = 4K; __ram = 0x20000000; -__ram_size = 32k; +__ram_size = 4k; __stack_size = 256; INCLUDE registers.ld diff --git a/src/samd21/altos.ld b/src/samd21/altos.ld deleted file mode 100644 index 40d9e4a1..00000000 --- a/src/samd21/altos.ld +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright © 2022 Keith Packard - * - * 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 of the License, 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; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -__flash = 0x00001000; -__flash_size = 128K - 4K; -__ram = 0x20000000; -__ram_size = 32k; -__stack_size = 256; - -INCLUDE registers.ld -INCLUDE picolibc.ld diff --git a/src/snekboard/Makefile b/src/snekboard/Makefile index 53a37c68..44c712d6 100644 --- a/src/snekboard/Makefile +++ b/src/snekboard/Makefile @@ -31,6 +31,11 @@ ALTOS_SRC = \ ao_usb_samd21.c \ ao_spi_samd21.c +# SAMD21G18A + +SAMD21_ROM=256 +SAMD21_RAM=32 + PRODUCT=SnekBoard PRODUCT_DEF=-DSNEKBOARD IDPRODUCT=0x000a @@ -46,7 +51,7 @@ OBJ=$(SRC:.c=.o) all: $(PROG) $(HEX) -$(PROG): Makefile $(OBJ) altos.ld +$(PROG): Makefile $(OBJ) $(call quiet,CC) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) $(OBJ): $(INC) diff --git a/src/telemetrum-v4.0/Makefile b/src/telemetrum-v4.0/Makefile index 5733a9d0..e1b627b9 100644 --- a/src/telemetrum-v4.0/Makefile +++ b/src/telemetrum-v4.0/Makefile @@ -28,6 +28,11 @@ INC = \ samd21.h \ Makefile +# SAMD21G17D + +SAMD21_ROM=128 +SAMD21_RAM=32 + #PROFILE=ao_profile.c #PROFILE_DEF=-DAO_PROFILE=1