Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

mixed alt_printf vs printf

Altera_Forum
Honored Contributor II
1,863 Views

Dear experts, 

 

I am a beginner using uC/OSII with Nios II EDS 10.1 sp1. 

 

Question: 

1. Is there any thing I should concern if I use alt_printf and printf in mixed? 

I found that task using alt_printf required smaller stack. 

# include <stdio.h># include "sys/alt_stdio.h"  

 

void task1(void) { 

printf("hello world\n"); 

OSTimeDlyHMSM(0, 0, 1, 0); 

 

void task2(void) { 

alt_printf("hello world\n"); 

OSTimeDlyHMSM(0, 0, 1, 0); 

 

 

Thank you in advance. 

skw
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
690 Views

I copy and paste from the Nios SW Developer's handbook: 

alt_printf() This function is similar to printf(), but supports only the %c, %s, %x, and %% substitution strings. alt_printf() takes up substantially less code space than printf(), regardless whether you select the lightweight device driver API. alt_printf() occupies less than 1Kbyte with compiler optimization level -O2.  

Regards 

Cris
0 Kudos
Altera_Forum
Honored Contributor II
690 Views

Cris, 

 

Thank you.
0 Kudos
Reply