Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ports/rps: Make FLASH LENGTH match PICO_FLASH_SIZE_BYTES in .ld files.#17344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

sfe-SparkFro
Copy link
Contributor

Summary

Resolves#17343

This dynamically sets theFLASHLENGTH value in the.ld files to matchPICO_FLASH_SIZE_BYTES, meaning it should match the size of the actual flash chip on whatever board is being built.

Testing

I have a project that requires over 4MB of flash for the firmware. I'm building the project for a board that has a 16MB flash chip, which is set byPICO_FLASH_SIZE_BYTES. Without these changes, I get the following error from the linker:

firmware.elf section `.text' will not fit in region `FLASH'`region `FLASH' overflowed by xxxx bytes

After these changes, it works fine.

Trade-offs and Alternatives

I do not believe this has any tradeoffs.

However, a possible alternative is to make theFLASHLENGTH truly configurable instead of dynamically set to match the board's flash size. I don't know whether that would actually be useful for anything though, so IMO best to keep it simple.

@github-actionsGitHub Actions
Copy link

Code size report:

   bare-arm:    +0 +0.000% minimal x86:    +0 +0.000%    unix x64:    +0 +0.000% standard      stm32:    +0 +0.000% PYBV10     mimxrt:    +0 +0.000% TEENSY40        rp2:    +0 +0.000% RPI_PICO_W       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS  qemu rv32:    +0 +0.000% VIRT_RV32

Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
@sfe-SparkFrosfe-SparkFroforce-pushed therp2_dynamic_flash_length_ld branch fromd3a2e29 to83c8f52CompareMay 22, 2025 20:53
@dpgeorge
Copy link
Member

In principle this looks reasonable, although I have two concerns:

  1. It requires board header files to correctly usepico_cmake_set_default PICO_FLASH_SIZE_BYTES, and not all of them do (the pico-sdk has some magic to grep for these strings and then expose the settings to cmake...). Eg NULLBITS_BIT_C_PRO doesn't have that definition and doesn't build with this PR.
  2. Eventually I want to auto-detect the size of the SPI flash, and allow the user to specify the size of filesystems (ROMFS, littlefs, FAT, etc) using a partition table. That might require a bit of trickery in the linker script, similar to what's done here.

(1) is pretty easy to fix for the boards in this repo (there's also POLOLU_ZUMO_2040_ROBOT, WEACTSTUDIO and WEACTSTUDIO_RP2350B_CORE to fix), although anyone with a custom board outside this repo might also need to add such a definition.

(2) is probably not an issue but worth considering.

Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
@sfe-SparkFro
Copy link
ContributorAuthor

@dpgeorge How about this? IfPICO_FLASH_SIZE_BYTES is not set (actually, it appears to get set to""), then it uses the same defaults as before (2MB for RP2040 or 4MB for RP2350).

IMO the default probably doesn't need to be different between the RP2040 and RP2350, but I'm just keeping the same behavior as before.

Copy link
Member

@dpgeorgedpgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, this looks good now. I tested NULLBITS_BIT_C_PRO and it now builds.

@dpgeorge
Copy link
Member

Squashed, rebased and merged in6bfb83e

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dpgeorgedpgeorgedpgeorge approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

ports/rp2: MakeFLASH length configurable in linker script.
2 participants
@sfe-SparkFro@dpgeorge

[8]ページ先頭

©2009-2025 Movatter.jp