rp2040: unify all linker scripts using LDFLAGS

The only thing that's different between all these chips is the flash
size, which can easily be passed as a linker flag instead. This removes
a bunch of duplicate code in an uncommon language (linker script).

I've also fixed a few boards with incorrect flash sizes:

  * nano-rp2040 has 16MB instead of 2MB
  * macropad-rp2040 has 8MB instead of 2MB
  * gopher-badge has 8MB instead of 1MB
Этот коммит содержится в:
Ayke van Laethem 2023-03-30 20:36:52 +02:00 коммит произвёл Ron Evans
родитель b044d4ff3d
коммит e0bf376068
26 изменённых файлов: 50 добавлений и 114 удалений

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:0003"],
"build-tags": ["badger2040"],
"linkerscript": "targets/badger2040.ld",
"ldflags": [
"--defsym=__flash_size=1020K"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:1023"],
"build-tags": ["challenger_rp2040"],
"linkerscript": "targets/feather-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=8M"
],
"extra-files": [
"targets/feather-rp2040-boot-stage2.S"
]

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["239a:80f1"],
"build-tags": ["feather_rp2040"],
"linkerscript": "targets/feather-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=8192K"
],
"extra-files": [
"targets/feather-rp2040-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 8192K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:0003"],
"build-tags": ["gopher_badge"],
"linkerscript": "targets/gopher-badge.ld",
"ldflags": [
"--defsym=__flash_size=8M"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["239a:8106"],
"build-tags": ["kb2040"],
"linkerscript": "targets/qtpy-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=8192K"
],
"extra-files": [
"targets/qtpy-rp2040-boot-stage2.S"
]

Просмотреть файл

@ -4,7 +4,9 @@
],
"build-tags": ["macropad_rp2040"],
"serial-port": ["239a:8107"],
"linkerscript": "targets/pico.ld",
"ldflags": [
"--defsym=__flash_size=8M"
],
"extra-files": [
"targets/macropad-rp2040-boot-stage2.S"
]

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2341:005e"],
"build-tags": ["nano_rp2040"],
"linkerscript": "targets/pico.ld",
"ldflags": [
"--defsym=__flash_size=16M"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -4,7 +4,9 @@
],
"build-tags": ["pico"],
"serial-port": ["2e8a:000A"],
"linkerscript": "targets/pico.ld",
"ldflags": [
"--defsym=__flash_size=2048K"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 2048K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["239a:80f7"],
"build-tags": ["qtpy_rp2040"],
"linkerscript": "targets/qtpy-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=8192K"
],
"extra-files": [
"targets/qtpy-rp2040-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 8192K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -12,6 +12,7 @@
"extra-files": [
"src/device/rp/rp2040.s"
],
"linkerscript": "targets/rp2040.ld",
"openocd-interface": "picoprobe",
"openocd-transport": "swd",
"openocd-target": "rp2040"

Просмотреть файл

@ -1,3 +1,10 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = __flash_size - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
_stack_size = 2K;

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["1b4f:0026"],
"build-tags": ["thingplus_rp2040"],
"linkerscript": "targets/thingplus-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=16M"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 16384K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["239a:8109"],
"build-tags": ["trinkey_qt2040"],
"linkerscript": "targets/trinkey-qt2040.ld",
"ldflags": [
"--defsym=__flash_size=8192K"
],
"extra-files": [
"targets/trinkey-qt2040-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 8192K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:0003"],
"build-tags": ["tufty2040"],
"linkerscript": "targets/tufty2040.ld",
"ldflags": [
"--defsym=__flash_size=1020K"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:0003"],
"build-tags": ["waveshare_rp2040_zero"],
"linkerscript": "targets/waveshare-rp2040-zero.ld",
"ldflags": [
"--defsym=__flash_size=1020K"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"

Просмотреть файл

@ -4,7 +4,9 @@
],
"serial-port": ["2e8a:000a"],
"build-tags": ["xiao_rp2040"],
"linkerscript": "targets/xiao-rp2040.ld",
"ldflags": [
"--defsym=__flash_size=1020K"
],
"extra-files": [
"targets/pico-boot-stage2.S"
]

Просмотреть файл

@ -1,10 +0,0 @@
MEMORY
{
/* Reserve exactly 256 bytes at start of flash for second stage bootloader */
BOOT2_TEXT (rx) : ORIGIN = 0x10000000, LENGTH = 256
FLASH_TEXT (rx) : ORIGIN = 0x10000000 + 256, LENGTH = 1020K - 256
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k
}
INCLUDE "targets/rp2040.ld"