Trying to do "hello world" on LaunchPad but getting errors. Seems pretty simple, but obviously I'm doing something wrong. I assume the G2231 supports printf?
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.
Trying to do "hello world" on LaunchPad but getting errors. Seems pretty simple, but obviously I'm doing something wrong. I assume the G2231 supports printf?
These error messages are only 'telling' if you know what a linker does and how.
As a newbie programmer, you often do not know about linker segments and therefore all this info has no meaning.
A simple message like
Error: code or data too large for available space! segment: .text maximum size: 0x77f bytes required size: 0x1000 bytes
would be way more clear. All the additional output is a nice add-on for those who know what's going on.
It is essentially the same information, but presented in a way that you immediately know what's wrong without need of 'expert' knowledge.
hello people, I would like to bring back this topic, as I have the same question at the last post which has not been answered yet.
Please teach us how to output something with G2231's limited flash memory.
sincerely thanks
Yes and no. Depends on what you want to do.
Yoo need to:
- create a function that outputs single bytes serially. This is the 'putchar' function, usually used by printf inplementations for sending the data. Output can happen through hhardware UART or software UART. See the demo code of the LaunchPad for a software UART implementation.
- create a fucntion that stuffs the output function with data, This is what printf normally does. However, printf contains so much formatting features that it is big. If oyu only want to send a plain text, you'll rather need something like puts() (which simply sends one byte of a string after the other to putchar, without any interpretation of numbers or other formatting).
For a small and fast implementation that turns a binary value into a human-readable number string (itoa() function), use the search function for "printf" on this board. Some solutions have been posted in the past.
After all, the main job in microcontroller programming is to write a solution that is as small and fast as possible for your applciaiton. Using big and bloated libraries for convenience is the domain of PC coders. Remember, that printf() is not part of the C language itself. It is just a function like any other. Conveniently added to most development suites, but an add-on nevertheless.
**Attention** This is a public forum