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

Bump default stack size for target pico to 8kb from 2kb #3993

Merged
merged 1 commit into from
Nov 12, 2023
Merged

Bump default stack size for target pico to 8kb from 2kb #3993

merged 1 commit into from
Nov 12, 2023

Conversation

scottfeldman
Copy link
Contributor

The pico-w wifi driver needs a minimum of 8kb stack size. The default stack size for pico (and pico-w) is 2kb, so -stack-size=8kb is needed when working with wifi driver. Unfortunately, developers working on the wifi driver forget to specify -stack-size=8kb when testing, resulting in the wifi driver lockup during initialization. Hours (or days) pass before we realize our mistake, and then HAND smacks HEAD and we specify --stack-size=8kb.

This RP sets the default stack size to 8kb for pico (and pico-w). This will help developers who forget -stack-size=8kb, and will help users once the pico-w wifi driver is available.

@soypat soypat requested a review from aykevl November 10, 2023 23:06
@soypat
Copy link
Contributor

soypat commented Nov 10, 2023

This catches me off way too often when working in a project I left in the backburner that requires it. I don't think it would be strictly necessary if there was a panic message for stack overflow. Sadly it just crashes and prints out nothing.

@sago35
Copy link
Member

sago35 commented Nov 11, 2023

@scottfeldman
Shouldn't we create a pico-w.json that includes different definitions for machine.BUTTON, even if it's just in json? Of course, I also think that changing the pico to 8kb is not a bad thing.

@scottfeldman
Copy link
Contributor Author

@scottfeldman Shouldn't we create a pico-w.json that includes different definitions for machine.BUTTON, even if it's just in json? Of course, I also think that changing the pico to 8kb is not a bad thing.

That makes sense to me. Would the correct approach be to make pico-w.json inherit from pico.json?

pico-w.json:

{
"inherits": [
"pico"
],
"default-stack-size": 8192,
}

@scottfeldman
Copy link
Contributor Author

Hmmm...there's probably a lot more to change when adding a new target. What machine things are different compared with pico? machine.LED must be diff since the LED goes thru the wifi chip on pico-w. What else? Maybe it's too early for this PR...but darn it, getting burned forgetting -stack-size is a time-waster.

@sago35
Copy link
Member

sago35 commented Nov 11, 2023

I think the pico-w.json you mentioned earlier should work fine. Just make sure not to forget to set -target pico-w, and that should be good enough.

@sago35
Copy link
Member

sago35 commented Nov 11, 2023

I think it's better to add machine/board_pico_w.go later.

@deadprogram
Copy link
Member

Thanks for adding this @scottfeldman and to @sago35 and @soypat for review. Now merging.

@deadprogram deadprogram merged commit d4189fe into tinygo-org:dev Nov 12, 2023
15 checks passed
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.

4 participants