Anguel 0 Posted February 27, 2013 Share Posted February 27, 2013 Hi! Yesterday I learned to know that chars ("bytes") on C2000 are actually 16 bit words :-( Unfortunately this is a complete waste of memory when we just need a simple byte (8 bits). For example take the C2000 launchkit demo and look at the memory map for the ti_ascii char array constant defined in ti_ascii.h. I wonder if there is an easy way to enter string constants so that they do not occupy twice the memory they actually need. The only way I can imagine is to enter them in HEX so that one 16 bit word actually contains two 8 bit chars. But this is very unfriendly as one has to type the hex code for each char instead of entering them as readable chars. Regards, Anguel Quote Link to post Share on other sites
TI_Trey 38 Posted February 27, 2013 Share Posted February 27, 2013 Anguel, You're absolutely right...our memory is 16 bits wide and in some applications this wastes space. We are not really a general purpose micro-controller though. The C2000 family of devices are more like mini DSPs and as such they are architected to perform best when doing complex math/control algorithms. Like I said these devices really aren't designed for string manipulation, but you certainly could hack something together (as you suggested) to try to save some space. I, however, do not know of a good way to do this currently in an automated fashion. Trey Quote Link to post Share on other sites
Anguel 0 Posted February 27, 2013 Author Share Posted February 27, 2013 Thank you for the feedback Trey. You are correct and I am afraid that the 32 KWords on the C2000 may be insufficient for more general-purpose embedded applications. So I will reconsider if it is not more suitable to use a TI Cortex M4F instead. This approach looks more universal and if I understand correctly, the Stellaris peripheral drivers are mature in contrast to the C2000 peripheral drivers. Is this correct? Quote Link to post Share on other sites
TI_Trey 38 Posted February 27, 2013 Share Posted February 27, 2013 Anguel, Yes you are correct. Those drivers have been around for several years now. Quote Link to post Share on other sites
gsrunion 0 Posted March 10, 2013 Share Posted March 10, 2013 You can use the __byte((int*)bufer, N) compiler "intrinsic" to access the Nth byte of a given buffer. That could make retrieval easier. However I don't think it would save any space when creating the array of chars because the litteral in __byte((int*)buffer, N) = 'a'; is probably still going to be stored in a 16 bit char. You could still build the array by doing hex and then grabbing the Nth char with the __byte((int*)buffer, N) intrinsic. As far as building the hex litterals for the array some excel or python magic could help. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.