 Question: What could go wrong in the procedures
followed?
1. include stdio.h
2. invoke printf according to its format
3. add -o option when running the simulator
4. the program ran successfully except the printf message did not show up anywhere
Answer: Also include trgcio.h ; this one
has the cio basic routines in it. The simulator does not support cio, only emulator (rev
5.20) Also, you need to include a section called .cio in the linker command file and
furthermore, the heap should be big enough for this routine.
Example:
*************** example.c ***************-
#include [stdio.h]
#include [trgcio.h]
void main (void)
{
unsigned char a[4]=TI;
printf (%s\n, a);
printf (TI\n);
}
-******************* link.cmd *******************-
-c
-stack 0x400
-heap 0x400
-lrts30.lib
/* SPECIFY THE SYSTEM MEMORY MAP */
MEMORY
{
EXT0: org = 0x200000 len = 0x2000
IRAM: org = 0x809800 len = 0x0800
}
/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */
SECTIONS
{
.text: > EXT0
.cinit: > EXT0
.const: > EXT0
.stack: > IRAM
.sysmem: > EXT0
.bss: > EXT0
.cio: > EXT0
}
-************ end of examples *******************-
|