2006-03-29 11:44 PM
2004-03-18 01:53 PM
hi there
how do you make cosmic functions like getchar and putchar work? ive rewritten the c source files and built them but it doesnt work the files i changed were - \COSMIC\CXST7\srcst7\MODC\LIBI\getchr.c & putchr.c \COSMIC\CXST7\srcst7\MODM\LIBI\getchr.c & putchr.c \COSMIC\CXST7\srcst7\MODS\LIBI\getchr.c & putchr.c ive then run build.bat in each directory- but nothing happens my check sum doesnt change when i change the files either. what am i doing wrong?? thanks for your help chris2004-03-18 08:08 PM
If you want to customize putchar and getchar functions there's no need to touch the libraries.
The best is to proceed as follows: - add a file to your project - write into this file the custom version of putchar and getchar - don't forget to include this file into the list of files to be linked (if you forget, the project will link anyway, but standard putchar and getchar will be used instead of yours, giving the feeling the system is not doing what you want) Hope this helps, Regards, Luca [ This message was edited by: _luca on 19-03-2004 09:39 ]2004-03-21 01:36 PM
thanks Luca
getchar and putchar works now, but i now get an error when using printf:- ''1 segment .share size overflow (10 ''. got any ideas? cheers chris2004-03-21 05:12 PM
.share stores the local variables of functions. The compiler takes care to ''overlap'' ram area used by two or more independent functions(which are not called at the same time). There is an overflow of this segment in your case, when using the printf function.
2004-09-30 10:27 PM
Hi everybody!
I'm new to MCU programming. Your discussion about putchar and getchar is very interesting for me because I would like to use the ST7 simulator and capture the standard output. Namely, I need to log all the strings emitted through the function printf into a file. Can you please tell me how do I have to rewrite putchr.c to do it? Thanks Ivan2004-10-01 02:17 AM
2004-10-04 02:57 AM
Hi,
Thank you for having answered but I can't understand how It could be! I took a look in the source code for the library; the function putchar appears to have an empty body. On the other side, however, the ''ST7 user manual'' ( one of the manuals packaged with cosmic compiler, page 143 ) says that... ''putchar is packaged in the integer library, and is by default using the first serial port SCI 1''. So, it seems that there has to be a way to capture standard output using the SCI 1. Now, if the SCI 1 serial port is the one I have to observe, how can I do it? Thank you Ivan2004-10-04 03:10 AM
2006-03-29 11:44 PM
Hi Luca,
I'm var new to MCU programming. Your discussion on writing to a file is very useful. I want to write a char buffer to a file. I am Using Cosmic compiler and Zap simulator. can you assist me. Thanks in advance... Regards, jaffar