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

Automatically count EXTERNAL_FLASH_DEVICES #4358

Merged
merged 3 commits into from
Mar 8, 2021

Conversation

jepler
Copy link
Member

@jepler jepler commented Mar 7, 2021

I compile-tested this with some single-device and some multi-device configurations, both A,B,C and `"A, B, C" styles and the calculated number matched the original number in each case.

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Nice simplification!

supervisor/supervisor.mk Outdated Show resolved Hide resolved
Instead of counting words in make, which is slightly awful, notice that
possible_devices is local to external_flash.c, so we can declare the array
with an automatic bound, and then get the count as the element-count
(MP_ARRAY_SIZE) of the array.

Since EXTERNAL_FLASH_DEVICE_COUNT is no longer a global macro, switch
a few sites to using EXTERNAL_FLASH_DEVICES in `#if` checks instead.
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

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

Well, that is a lot easier than torturing yourself with string manipulation in makefiles 😄

@jepler jepler merged commit 16f82b9 into adafruit:main Mar 8, 2021
@jepler jepler deleted the count-flash-devices branch November 3, 2021 21:09
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.

2 participants