Skip to content

Commit

Permalink
match memory layout to volcano remote project
Browse files Browse the repository at this point in the history
  • Loading branch information
xythobuz committed Dec 19, 2023
1 parent 682ce01 commit 9e9371e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
18 changes: 15 additions & 3 deletions bootloader_shell.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,28 @@
__stack (== StackTop)
*/

/*
* TODO hard-coded.
* Should take into account PICO_FLASH_BANK_STORAGE_OFFSET
* and DISK_BLOCK_SIZE and DISK_BLOCK_COUNT from config.h
*/
__PERSISTENT_STORAGE_LEN = (3 * 4k);
__FLASH_CACHE_LEN = (48 * 4k);
__ADDITIONAL_LEN = (__PERSISTENT_STORAGE_LEN + __FLASH_CACHE_LEN);

/*
* TODO: Hard-code 360k, which is the max size I see on my machine with
* 'sta' mode and debug printf.
* There must be a better way to determine the size dynamically somehow.
*/
__BOOTLOADER_LEN = 360k;
__IMG_HDR_LEN = 4k;
__BOOTLOADER_IMG_LEN = (__BOOTLOADER_LEN + __IMG_HDR_LEN);
MEMORY
{
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 360k
FLASH_IMGHDR(rx) : ORIGIN = 0x10000000 + 360k, LENGTH = 4k
FLASH_APP(rx) : ORIGIN = 0x10000000 + 364k, LENGTH = 2048k - 364k
FLASH(rx) : ORIGIN = 0x10000000, LENGTH = __BOOTLOADER_LEN
FLASH_IMGHDR(rx) : ORIGIN = 0x10000000 + __BOOTLOADER_LEN, LENGTH = __IMG_HDR_LEN
FLASH_APP(rx) : ORIGIN = 0x10000000 + __BOOTLOADER_IMG_LEN, LENGTH = 2048k - __ADDITIONAL_LEN - __BOOTLOADER_IMG_LEN
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
Expand Down
21 changes: 20 additions & 1 deletion standalone.ld
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@
__stack (== StackTop)
*/

INPUT (./fat_fs.o)

/*
* TODO hard-coded.
* Should take into account PICO_FLASH_BANK_STORAGE_OFFSET
* and DISK_BLOCK_SIZE and DISK_BLOCK_COUNT from config.h
*/
__PERSISTENT_STORAGE_LEN = (3 * 4k);
__FLASH_CACHE_LEN = (48 * 4k);
__ADDITIONAL_LEN = (__PERSISTENT_STORAGE_LEN + __FLASH_CACHE_LEN);

/* Skip 364kB at the start of flash, that's where the bootloader is */
__BOOTLOADER_LEN = 360k;
__IMG_HDR_LEN = 4k;
__BOOTLOADER_IMG_LEN = (__BOOTLOADER_LEN + __IMG_HDR_LEN);
MEMORY
{
FLASH(rx) : ORIGIN = 0x10000000 + 364k, LENGTH = 2048k - 364k
FLASH(rx) : ORIGIN = 0x10000000 + __BOOTLOADER_IMG_LEN, LENGTH = 2048k - __ADDITIONAL_LEN - __BOOTLOADER_IMG_LEN
FLASH_CACHE(r) : ORIGIN = 0x10000000 + __BOOTLOADER_IMG_LEN + (2048k - __ADDITIONAL_LEN - __BOOTLOADER_IMG_LEN) , LENGTH = __FLASH_CACHE_LEN
RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
Expand Down Expand Up @@ -213,6 +228,10 @@ SECTIONS
*(.stack*)
} > SCRATCH_Y

.fat_fs_bin : {
KEEP(./fat_fs.o (.fat_fs_bin))
} > FLASH_CACHE

.flash_end : {
__flash_binary_end = .;
} > FLASH
Expand Down

0 comments on commit 9e9371e

Please sign in to comment.