Comments (8)
After some thoughts, here is my proposal regarding this migration:
- Remove all bitfields usage in our codebase (no more foo->bar.bit.xyz only foo->bar.reg)
- Creation of a new header for missing declarations
- Replace all single bit field using new declarations from the newly generated header (FOO_BAR_BITFIELD -> FOO_BAR_BITFIELD_Msk)
- Creation of a wrapper for register calls
- Make use of new wrapper in boards/ and cpu/
- Add a deprecation notice during build
- Add new Microchip vendor files under
cpu/sam0_common/include/vendor_ng
- use AT BOARD LEVEL a new variable to switch to new headers
- Starting cleanup after one or two releases
from riot.
Regarding step 2 & 3:
These are mandatory because of the way Microchip build their new vendor files.
Currently when the bitfield inside a register is more than 1 bit. We have
FOO_BAR_Pos
FOO_BAR_Msk
FOO_BAR(value)
This is the same AFAICT on new vendor files.
However, there is a difference when the bitfield is only one bit wide.
For example RTC_CTRLA_ENABLE
(current header we have) is now spelled RTC_CTRLA_ENABLE_Msk
on new vendor.
On new vendor files, Microchip decided to unify the use of _Msk for every bitfields.
This is why I propose to introduce a new header, which will be generated though a script.
The idea will be to parsed the current headers, look for both FOO_BAR_Pos
and FOO_BAR_Msk
. If both exist, we're good. If only _Pos exists, then generated a _Msk so we can match the behavior of the new vendor files.
Of course, this header will be dropped at the end of the migration process during the cleanup.
from riot.
About the wrapper, I was thinking about something like
#if USE_MCHP_VENDOR_NG
#define REG(dev, offset) ((dev)->dev##_##offset)
#else
#define REG(dev, offset) ((dev)->offset.reg)
#endif
On new header, Microchip slightly change the new of every registers inside a peripheral.
For instance
RTC->CTRLA.reg
(current header) should be use as RTC->RTC_CTRLA
(on new header).
With the proposed macro, it will be REG(RTC, CTRLA)
I think such macro will allow us to avoid some pain.
from riot.
Microchip is right in their decision to drop bitfields that is to much comfort.
Changing bits should be a pain in the rear end with macros all over place.
The only positive thing about bitfield removal is that this might make more people aware that changing a bit often is a register read modify write ( and since they a usually marked volatile each bit modification has their own). But for that they would not need to also drop the structures just the mapping to addresses.
from riot.
Changing bits should be a pain in the rear end with macros all over place.
Hopefully, all those macros will be there for a given time. This way, users will have time to adapt their out of the tree code.
However, I am planning on cleaning up everything (and thus remove all macros) after one or two releases.
So yeah, it will take time but in the end, it will look "as before".
from riot.
maybe they just want to kill of c development by droping the wins of 15 year and go back to 1990s C
from riot.
maybe they just want to kill of c development by droping the wins of 15 year and go back to 1990s C
I think, this is related to their recent migration to MPLABX and their will to unify SAM0 to PIC32.
I've complained to them (through a ticket) about this. Especially doing this WITHOUT deprecation notice.
They acknowledge the issue but they were like "it is what it is"
from riot.
sounds little like they dislike their customers
from riot.
Related Issues (20)
- stdio_rtt is loosing output
- doxygen: @ingroup does not support braces HOT 23
- Standard output is truncated and sent to the shell input on Arduino Nano 33 BLE for the default example HOT 9
- boards/nRF: Make documentation more consistent and updated HOT 1
- BlackMagicProbe does not recognize nRF52 device HOT 2
- cpu/msp430: USCI not working with auxiliary clock HOT 1
- High-level stdio is not beginner friendly when they use asserts HOT 2
- Bug: BUILD_IN_DOCKER in Makefile on WSL not working as intended / breaking the build
- mcp2515: can driver incomplete ID flag handling
- test files required to compile HOT 1
- gcoap_fileserver: can't deal with 16 byte block size HOT 2
- boards/b-l072z-lrwan1 missing adc feature
- Erroneous, though benign, bit operation for nrf5x gpio HOT 2
- Event based Bottom Half Processing failing to post an event HOT 2
- Allow custom FEATURE to be defined from an external source HOT 2
- boards/nucleo-l4xxx: hang during ADC initialization
- OpenWSN on nrf52840dk: error with JRC
- Nightly Rust features fails with BUILD_IN_DOCKER HOT 2
- Bugs in functions thread_zombify() and/or thread_kill_zombie() HOT 1
- Can't delete key currently in DragonflyDB via RIOT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riot.