Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12366 Discussions

small-c Project not support to scanf function?

CChoi13
Beginner
266 Views

I use the 10M08DFV device, and i should make nios ii project by small-c because memory ram size is too small. 

but my remote software update project occur error of scanf function...

I want the scanf function to work in a small-c environment.

The example Remote software update provided by Altera used scanf function.

Due to memory problems, I created a project using small-c on a 10M08DFV device.

When I compiled the project, Eclipse printed an error message that the scanf function was not defined.

so please check the my problem.

 

 

bellow is the error message

----------------------------------------------------------------------------------

21:34:53 **** Incremental Build of configuration Nios II for project optic_cpu ****

make all 

Info: Building ../optic_cpu_bsp/

C:/intelFPGA/17.1/nios2eds/bin/gnu/H-x86_64-mingw32/bin/make --no-print-directory -C ../optic_cpu_bsp/

[BSP build complete]

Info: Compiling main.c to obj/default/main.o

nios2-elf-gcc -xc -MP -MMD -c -I../optic_cpu_bsp//HAL/inc -I../optic_cpu_bsp/ -I../optic_cpu_bsp//drivers/inc -pipe -D__hal__ -DALT_NO_C_PLUS_PLUS -DALT_NO_CLEAN_EXIT -D'exit(a)=_exit(a)' -DALT_NO_EXIT -DALT_USE_DIRECT_DRIVERS -DALT_NO_INSTRUCTION_EMULATION -DALT_USE_SMALL_DRIVERS -DSMALL_C_LIB -DALT_SINGLE_THREADED  -Os -g -Wall  -mno-hw-div -mhw-mul -mno-hw-mulx -mgpopt=global -o obj/default/main.o main.c

Info: Linking optic_cpu.elf

nios2-elf-g++ -T'../optic_cpu_bsp//linker.x' -msys-crt0='../optic_cpu_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../optic_cpu_bsp/ -msmallc -Wl,-Map=optic_cpu.map  -Os -g -Wall  -mno-hw-div -mhw-mul -mno-hw-mulx -mgpopt=global -o optic_cpu.elf obj/default/init_cpu.o obj/default/main.o -lm -msys-lib=m

obj/default/main.o: In function `main':

C:\work\030_Altera_DPFX700_RSU\062_DPFX_700_RSU_UART_EDIT\TX\optic_cpu\software\optic_cpu/main.c:242: undefined reference to `scanf'

collect2.exe: error: ld returned 1 exit status

make: *** [optic_cpu.elf] Error 1

 

21:34:55 Build Finished (took 2s.74ms)

0 Kudos
3 Replies
EricMunYew_C_Intel
Moderator
239 Views

Hi, Choi


Have you tried to enable "Enable Lightweight Device Driver API" in your BSP ?


Thanks.


Eric


EricMunYew_C_Intel
Moderator
232 Views

Hi, Choi


You can check or enable the "Enable Lightweight Device Driver API" in your BSP, then you will be able to do scanf.


Do you have anymore question ? can we close the case ?


Thanks.


Eric




EricMunYew_C_Intel
Moderator
224 Views

Hi, Choi


I have already answered you in my reply. I will close the case.


Thanks.


Eric


Reply