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++
12589 Discussions

baremetal application development in C++

Altera_Forum
Honored Contributor II
1,729 Views

I'm looking for information on how to develop a Cyclone V SoC HPS baremetal application as a C++ project. I have found numerous C only examples and have followed the Getting Started tutorial from AlteraWiki. I then tried to use the concepts learned to create a simple C++ UART project using the "Creating a Bare-metal HwLibs Project Manually" section in the Getting Started tutorial. I copied the H/W library file alt_16550_uart.c to my project and added the applicable# include "alt_16550_uart.h" within the extern "C" {} to my main.cpp file. When I tried to build the project I get the following error: 

 

armcc --cpu=Cortex-A9 --apcs=/hardfp --arm -Dsoc_cv_av -DPRINTF_UART -I"C:\Users\alvarlj1\Documents\DS-5 Workspace\test_c_proj/src" -I"C:/intelFPGA/17.0/embedded\ip\altera\hps\altera_hps\hwlib\include" -I"C:/intelFPGA/17.0/embedded\ip\altera\hps\altera_hps\hwlib\include\soc_cv_av" -O0 -g --md --depend_format=unix_escaped --no_depend_system_headers --depend_dir="src" -c -o "src/main.o" "../src/main.cpp" 

"C:/intelFPGA/17.0/embedded\ip\altera\hps\altera_hps\hwlib\include/hwlib.h", line 42: Error: # 5: cannot open source input file "cstdbool": No such file or directory 

# include <cstdbool> 

 

I looked for this file in the ARM compiler include folder and I see the other two C++ standard library files, cstddef and cstdint, but not the cstdbool file. I tried to start with a C project and my main.cpp and have the same problem. Looks like if "alt_16550_uart.h" or any other hw library file that uses "hwlib.h" is included in any .cpp file I get this error. I'm using ARM DS-5 Intel SoC FPGA Edition version 5.27.0 build number 5270014. 

 

Thank you, 

 

Luis Alvarez
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
744 Views

 

--- Quote Start ---  

 

I looked for this file in the ARM compiler include folder and I see the other two C++ standard library files, cstddef and cstdint, but not the cstdbool file. I tried to start with a C project and my main.cpp and have the same problem. Looks like if "alt_16550_uart.h" or any other hw library file that uses "hwlib.h" is included in any .cpp file I get this error. I'm using ARM DS-5 Intel SoC FPGA Edition version 5.27.0 build number 5270014. 

 

Thank you, 

 

Luis Alvarez 

--- Quote End ---  

 

Just place an empty cstdbool file in your source files directory. 

This solves the problem in my case.
0 Kudos
Altera_Forum
Honored Contributor II
744 Views

Thanks sonycman, 

 

Your suggestion got me past the hwlib.h but I'm still not able to successfully compile the application. Now my problem is with the alt_clock_group.h. If I include the hw library header files in main.cpp after using namespace I get 4 "invalid union member" errors. If I include them before using namespace I get 31 errors, most about int32_t being undefined.
0 Kudos
MCOUNSELL
New Contributor I
744 Views

Hi All,

 

I'm seeing the same issue regarding "invalid union member" errors from alt_clock_group.h when trying to compile with C++. Did anyone find a solution?

 

Mike

0 Kudos
Reply