Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change libpico.a to build with PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64 #315

Merged
merged 1 commit into from
Sep 19, 2021

Conversation

dhalbert
Copy link
Contributor

@dhalbert dhalbert commented Sep 17, 2021

Some samples of some Adafruit boards need a longer XOSC startup delay. We diagnosed this a while ago and PR'd a change to pico-sdk that adds a new compile-time constant PICO_XOSC_STARTUP_DELAY_MULTIPLIER, which allows lengthening the XOSC delay.

arduino-pico uses a single build of libpico.a for all boards. To accomodate the Adafruit boards, this PR sets PICO_XOSC_STARTUP_DELAY_MULTIPLIER=64 for the build, and provides a newly built libpico.a. The extra delay is still quite short, and shouldn't interfere with normal startup.

I tested this on an Adafruit QT Py RP2040 that is known to need a longer startup time. THe board would not run after a power cycle or reset before this fix, and now it works fine.

See raspberrypi/pico-sdk#457 and raspberrypi/pico-sdk#401 for some background on this problem.

@earlephilhower I am not sure of your workflow for rebuilding libpico.a with make-libpico.sh. I built libpico.a manually with make-libpico.sh inside .arduino15 using the lastest pico BSP, and then copied it into the commit for this PR. I had to do some manual fiddling with my PATH to make sure to use the compiler you include in the BSP. The make-libpico.sh script assumes the correct arm-none-eabi-gcc is on PATH, and also looks for tools in system, though my system only includes system/placeholder. So I had to set things up manually to make the script work.

Tagging @ladyada for FYI.

@hathach
Copy link
Contributor

hathach commented Sep 18, 2021

@dhalbert libpico.a is built by running this script in the tool https://github.com/earlephilhower/arduino-pico/blob/master/tools/libpico/make-libpico.sh . With this change, I think we could change the boot2 of qtpy from boot2_generic_03h_4_padded_checksum to boot2_w25q080_2_padded_checksum for fast running code, I will pull and check it out.

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@earlephilhower
Copy link
Owner

@dhalbert the build script actually assumes that you've got a git clone copy of the repo where the toolchain is in a subdir of the main core (hence the hardcoded ../../ in the PATH).

In any case, I'll pull this and give it a whirl and merge if all looks well.

@earlephilhower earlephilhower merged commit ad905ae into earlephilhower:master Sep 19, 2021
@dhalbert dhalbert deleted the set-xosc-multiplier branch September 19, 2021 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adafruit ItsyBitsy RP2040 - sketch doesn't run after reset or unplugging, following upload
3 participants