-
Notifications
You must be signed in to change notification settings - Fork 11
Add logic tree for conditional voltage setting based on freq request #37
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
Open
Json-To-String
wants to merge
2
commits into
labscript-suite:overclock
Choose a base branch
from
Json-To-String:overclock
base: overclock
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,49 +1,46 @@ | ||
| set(overclocks 0;1) | ||
|
|
||
| foreach (overclock IN LISTS overclocks) | ||
| # Compute firmware name | ||
| set(firmware_name prawnblaster) | ||
| if(PICO_PLATFORM MATCHES "^rp2350") | ||
| set(firmware_name "${firmware_name}_rp2350") | ||
| else() | ||
| set(firmware_name "${firmware_name}_${PICO_PLATFORM}") | ||
| endif() | ||
| if(overclock) | ||
| set(firmware_name "${firmware_name}_overclock") | ||
| endif() | ||
|
|
||
| add_executable(${firmware_name} prawnblaster.cpp fast_serial.c) | ||
|
|
||
| pico_generate_pio_header(${firmware_name} ${CMAKE_CURRENT_LIST_DIR}/pseudoclock.pio) | ||
|
|
||
| # Pass in number of instructions to firmware as a compiler definition | ||
| set(num_instructions 30000) | ||
| if(PICO_PLATFORM MATCHES "^rp2350") | ||
| set(num_instructions 60000) | ||
| endif() | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_NUM_INSTRUCTIONS=${num_instructions}") | ||
|
|
||
| # Pass in board type to firmware as a compiler definition. Note that PICO_BOARD is passed in by the SDK, but it's passed in a string which isn't valid and so I can't use it... | ||
| # This is also, to some extent, a duplicate of the above PRAWNBLASTER_NUM_INSTRUCTIONS but I think it makes sense to keep these seperate. | ||
| if (PICO_BOARD STREQUAL "pico") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_PICO_BOARD=1") | ||
| elseif (PICO_BOARD STREQUAL "pico2") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_PICO_BOARD=2") | ||
| else () | ||
| message(FATAL_ERROR "Unsupported PICO_BOARD") | ||
| endif() | ||
|
|
||
|
|
||
| # Pass in overclock state to firmware as a compiler definition | ||
| if(overclock) | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_OVERCLOCK=1") | ||
| endif() | ||
|
|
||
| # Pull in our pico_stdlib which aggregates commonly used features | ||
| target_link_libraries(${firmware_name} pico_stdlib hardware_pio pico_multicore pico_unique_id hardware_clocks hardware_dma hardware_vreg tinyusb_device tinyusb_board) | ||
| target_include_directories(${firmware_name} PRIVATE .) | ||
|
|
||
| # create map/bin/hex/uf2 file etc. | ||
| pico_add_extra_outputs(${firmware_name}) | ||
|
|
||
| endforeach() | ||
| # Compute firmware name | ||
| set(firmware_name prawnblaster) | ||
| if(PICO_PLATFORM MATCHES "^rp2350") | ||
| set(firmware_name "${firmware_name}_rp2350") | ||
| else() | ||
| set(firmware_name "${firmware_name}_${PICO_PLATFORM}") | ||
| endif() | ||
| # if(overclock) | ||
| # set(firmware_name "${firmware_name}_overclock") | ||
| # endif() | ||
|
|
||
| add_executable(${firmware_name} prawnblaster.cpp fast_serial.c) | ||
|
|
||
| pico_generate_pio_header(${firmware_name} ${CMAKE_CURRENT_LIST_DIR}/pseudoclock.pio) | ||
|
|
||
| # Pass in number of instructions to firmware as a compiler definition | ||
| set(num_instructions 30000) | ||
|
|
||
| # Pass in freq limits to firmware in MHz | ||
| set(normal_freq_limit 133) | ||
| set(overclock_freq_limit 200) | ||
|
|
||
| if(PICO_PLATFORM MATCHES "^rp2350") | ||
| set(num_instructions 60000) | ||
| set(normal_freq_limit 150) | ||
| endif() | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_NUM_INSTRUCTIONS=${num_instructions}") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_NORMAL_FREQ_LIMIT=${normal_freq_limit}") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_OVERCLOCK_FREQ_LIMIT=${overclock_freq_limit}") | ||
|
|
||
| # Pass in board type to firmware as a compiler definition. Note that PICO_BOARD is passed in by the SDK, but it's passed in a string which isn't valid and so I can't use it... | ||
| # This is also, to some extent, a duplicate of the above PRAWNBLASTER_NUM_INSTRUCTIONS but I think it makes sense to keep these seperate. | ||
| if (PICO_BOARD STREQUAL "pico") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_PICO_BOARD=1") | ||
| elseif (PICO_BOARD STREQUAL "pico2") | ||
| target_compile_definitions(${firmware_name} PUBLIC "PRAWNBLASTER_PICO_BOARD=2") | ||
| else () | ||
| message(FATAL_ERROR "Unsupported PICO_BOARD") | ||
| endif() | ||
|
|
||
| # Pull in our pico_stdlib which aggregates commonly used features | ||
| target_link_libraries(${firmware_name} pico_stdlib hardware_pio pico_multicore pico_unique_id hardware_clocks hardware_dma hardware_vreg tinyusb_device tinyusb_board) | ||
| target_include_directories(${firmware_name} PRIVATE .) | ||
|
|
||
| # create map/bin/hex/uf2 file etc. | ||
| pico_add_extra_outputs(${firmware_name}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a small concern about this logic tree. If we go from an overclock state to a normal state, the Vreg will be set down before the frequency change, potentially leading to instability.
We should test that hypothesis thoroughly to see if it is a problem before actually changing code though.