-
-
Notifications
You must be signed in to change notification settings - Fork 80
[EV3] Four misc fixups #365
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
39c1f48
pbio/drv/sound/sound_ev3.c: Only turn on amplifier when sound is played
ArcaneNibble 1d0471d
pbio/include/pbdrv/cache.h: Turn into proper driver module
ArcaneNibble 1b6d89e
bricks/_common/micropython.c: Handle unaligned module size
ArcaneNibble 3142d3c
pbio/platform/ev3/platform.ld: Ensure .bss is NOLOAD
ArcaneNibble 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
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
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| // Copyright (c) 2025 The Pybricks Authors | ||
|
|
||
| #include <pbdrv/config.h> | ||
|
|
||
| #if PBDRV_CONFIG_CACHE_EV3 | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| #include <tiam1808/armv5/cp15.h> | ||
|
|
||
| #include <pbdrv/compiler.h> | ||
|
|
||
| void pbdrv_cache_prepare_before_dma(const void *buf, size_t sz) { | ||
| // Make sure all data is written by the compiler... | ||
| pbdrv_compiler_memory_barrier(); | ||
| // and then make sure it's written out of the cache... | ||
| CP15DCacheCleanBuff((uint32_t)buf, sz); | ||
| // and also the write buffer, in case the cache missed. | ||
| CP15DrainWriteBuffer(); | ||
| } | ||
|
|
||
| void pbdrv_cache_prepare_after_dma(const void *buf, size_t sz) { | ||
| // Invalidate stale data in the cache... | ||
| CP15DCacheFlushBuff((uint32_t)buf, sz); | ||
| // and then make sure _subsequent_ reads cannot be reordered earlier. | ||
| pbdrv_compiler_memory_barrier(); | ||
| } | ||
|
|
||
| #endif // PBDRV_CONFIG_CACHE_EV3 |
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
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
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
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
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 |
|---|---|---|
|
|
@@ -60,7 +60,7 @@ SECTIONS | |
| *(.data.*) | ||
| } > DDR | ||
|
|
||
| .bss : | ||
| .bss (NOLOAD) : | ||
| { | ||
| . = ALIGN(4); | ||
| _bss_start = .; | ||
|
|
||
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.
We currently only support 32-bit platforms, but I think this should be pointer-size aligned rather than 32-bit aligned.
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.
mpy_info_tis explicitly defined with a 32-bit size regardless of platform pointer sizeThere 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.
Not sure what that has to do with the binary file itself needing to be pointer-aligned in memory.
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.
It sounds like we are planning to fix alignment issues later.
The check here is sufficient for preventing an invalid read.