Comments (4)
Apparently my assumption was wrong: "code option" != "easy pdk fuse" and all other code options are configured in other, undocumented registers.
The point about PDK_SET_FUSE();
not using the factory defaults still stands though.
from pdk-includes.
@cmfcmf - Because of the incorrect assumptions regarding FUSE vs. MISC2/MISC_LVR/ROP in your first post, it's a little hard to figure out what exactly you are proposing, but I'll try to respond to some of your concerns.
First, the concept of 'default' value is a little ambiguous...
One interpretation of default value, would be to use the default value as defined in the Padauk IDE's .INC source files. The potential problem with this is they disagree a bit with each other. For instance, the default value for the PFS173 would include Security Off, but the default value for PMS152 uses Security On. That would potentially be a bit confusing to have the behavior change from IC to IC. And, sometimes you would have to OR in an option, other times you would have to AND it in, which would get complex rapidly.
Another interpretation of default value, would be to use the value as comes pre-installed on a 'blank IC. Because of the way ROM works, this means that every bit that matters starts out as a 1, and would have to be programmed down to 0 as needed. So, AND would have to be used instead of OR for FUSE options. This is also a bit confusing as sometimes (depending on the IC) the 'unused' bits that are supposed to be low are a 1, and it is unclear what happens if they aren't actually programmed to a 0.
So, currently we are using a mask that sets all the required low bits to 0 properly, and leaves all the option bits at 0, unless turned on by OR'ing an option's value. This means we are more consistent from IC to IC. Maybe it would make more sense to invert things and instead AND in an option's value, but that seems less consistent to the way we usually set up registers (almost always done using OR).
Sometimes just using PDK_SET_FUSE() without passing anything in might give the correct defaults, but that doesn't seem like something that should be relied on. I would think best practice is to always define each and every option that matters when setting a FUSE value. We could actually change the definition of PDK_SET_FUSE to require each option to be set, but that might be a little too restrictive.
Perhaps @freepdk also wants to weigh in on why the fuse values are set the way they are?
from pdk-includes.
Thank you for your detailed explanation. ๐
Given that there doesn't seem to be the defition of what exactly should be the default value, I'm fine with leaving everything as is.
We could actually change the definition of PDK_SET_FUSE to require each option to be set, but that might be a little too restrictive.
That would mean something along the lines of PDK_SET_FUSE(FUSE_SECURITY_ON, FUSE_PB4_PB5_NORMAL, FUSE_BOOTUP_SLOW);
, so that the user cannot forget one of the fuse settings, right?
The potential downside I'm seeing with this is that different ยตCs might be using a different number of fuses, therefore the PDK_SET_FUSE
would potentially need to be defined per device.
from pdk-includes.
Thank you for your detailed explanation. ๐
Given that there doesn't seem to be the defition of what exactly should be the default value, I'm fine with leaving everything as is.
Ok, sounds good. Go ahead and close this issue if you are happy with things as they are.
We could actually change the definition of PDK_SET_FUSE to require each option to be set, but that might be a little too restrictive.
That would mean something along the lines of
PDK_SET_FUSE(FUSE_SECURITY_ON, FUSE_PB4_PB5_NORMAL, FUSE_BOOTUP_SLOW);
, so that the user cannot forget one of the fuse settings, right?
Yes, exactly. Again, not recommended, but that is an option.
The potential downside I'm seeing with this is that different ยตCs might be using a different number of fuses, therefore the
PDK_SET_FUSE
would potentially need to be defined per device.
I agree with the downside you mentioned.
Another potential downside would be less portable code. For instance, what if your program only cares about FUSE_SECURITY_OFF and FUSE_BOOTUP_FAST. With PDK_SET_FUSE the way it currently is, the same code could be used across most (if not all) ยตCs, and the other more specific fuse options would just get set to their 'defaults' (all 1s). Changing to the above more restrictive PDK_SET_FUSE option, would mean a lot of #ifdef
lines making for really messy source code.
from pdk-includes.
Related Issues (9)
- Small differences between devices HOT 12
- PMS150G support? HOT 4
- How to add a new device? HOT 6
- Discrepency with PFS154 fuses versus current datasheet HOT 3
- HAS_* macro names HOT 2
- macros for using factory calibration values HOT 7
- Add LICENSE HOT 6
- Merge easy-pdk includes into this repository / inclusion in SDCC 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 pdk-includes.