??? 03/02/11 08:46 Read: times |
#181383 - Why? Responding to: ???'s previous message |
1) Why do you place huge amounts of data that - at least to me - doesn't seem to belong together? Is it a concept of avoiding global variables by having everything in a single global struct instead - or maybe a "hidden" struct that gets accessed through a pointer?
2) You claim you align to align 2, 4, 8, 16, ..., 128 - why? The 8051 does not have any huge alignment requirements (or hardly any at all) except possibly when you have flash data in a segmented flash. 3) It doesn't matter how much xdata you have. You either bank-switch your xdata address range, or you don't. If you don't, but you bank-switch your code, then you should still only have one copy of every variable. And if some data is stored in flash, it should only be banked if that specific const data is intended for a single bank of code - if it is for all banks then it should be linked into the common code region. If the common code region is too small for your const data and you really need so huge amounts of code data, then you need to create a specific bank for that code data and in the common region have get() functions that performs a bank-switch + makes a copy of the data and then returns to the requesting function/bank. 4) If your large data is basically read-only but needs to be configurable, then it would fit nicely in a serially accessed flash memory without the need for huge amounts of XDATA. if your data is totally read-only, then it fits in const flash - still with a get_record() function to retrieve an entry. If the data needs to be reglarly modified, then it can't be duplicated depending on what code bank you play with. And you shouldn't use any padding since you don't have any advantage of any padding. But in the end, you seem to complicate everything to the nth level. Haven't you heard about the KISS principle? Keep It Simple Stupid - i.e. never select a more complicated solution when a simpler solution exists, and works. Only design complicated products when your customer explicitly wants to pay you for a complicated product. You don't get extra money from the customer by adding own complications - you are just destroying your own profit margin or wasting your own time. |
Topic | Author | Date |
Multiple public definitions in code banking | 01/01/70 00:00 | |
single const byte in code | 01/01/70 00:00 | |
The meaning of 'const' in ANSI 'C' | 01/01/70 00:00 | |
Yes | 01/01/70 00:00 | |
Keil C51 isn't a C++ compiler | 01/01/70 00:00 | |
Coding Standard Rules - Netrino | 01/01/70 00:00 | |
Rule #2 is a bit broken or at least incompletely formulated | 01/01/70 00:00 | |
issue with #define usage | 01/01/70 00:00 | |
extern const code declaration | 01/01/70 00:00 | |
Insufficient detail | 01/01/70 00:00 | |
Conceptually wrong | 01/01/70 00:00 | |
Thanks, it's working ! | 01/01/70 00:00 | |
Why? | 01/01/70 00:00 | |
correction | 01/01/70 00:00 | |
Fundamental 'C' programming error! | 01/01/70 00:00 |