This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F2800157: How to store c strings more efficiently

Part Number: TMS320F2800157


Is there a recommended approach to storing strings more efficiently than 1 character per 16-bit memory location? We keep a buffer of a few kB to store ASCII logs that balloon to 2x that when run on the C2000. Is there a way to use printf to write to a uint16 array more efficiently or a feature to pack a uint16 array without manually iterating over the entire thing?

  • Hello Dan,

    Is there a recommended approach to storing strings more efficiently than 1 character per 16-bit memory location?
    Is there a way to use printf to write to a uint16 array more efficiently or a feature to pack a uint16 array without manually iterating over the entire thing?

    We don't have any software to support this specific purpose that I know of, you will have to create this algorithm yourself. You will likely have to iterate through the whole array, even if we did have some feature for this it would probably be iterating through the whole array anyways. Let me know if you have any questions on this. The best algorithm I can come up with at the moment is iterating through each element, shifting the nth element left by 8 bits, and copying the ASCII value of the n+1 element into the lower 8 bits.

    Best regards,

    Omer Amir