Read: 273 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.
|Multiple public definitions in code banking||Praveen Kumar||02/26/11 01:23|
|single const byte in code||Per Westermark||02/26/11 03:14|
|The meaning of 'const' in ANSI 'C'||Andy Neil||02/26/11 03:21|
|Yes||Per Westermark||02/26/11 04:12|
|Keil C51 isn't a C++ compiler||Andy Neil||02/26/11 04:44|
|Coding Standard Rules - Netrino||Praveen Kumar||02/26/11 04:09|
|Rule #2 is a bit broken or at least incompletely formulated||Per Westermark||02/26/11 04:33|
|issue with #define usage||Andy Neil||02/26/11 04:42|
|extern const code declaration||Praveen Kumar||02/28/11 06:03|
|Insufficient detail||Andy Neil||02/28/11 06:22|
|Conceptually wrong||Per Westermark||02/28/11 06:45|
|Thanks, it's working !||Praveen Kumar||03/02/11 01:22|
|Why?||Per Westermark||03/02/11 01:46|
|correction||Erik Malund||03/02/11 06:22|
|Fundamental 'C' programming error!||Andy Neil||02/26/11 03:18|