Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

baremetal application development in C++

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

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- 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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
    • MCOUNSELL's avatar
      MCOUNSELL
      Icon for Occasional Contributor rankOccasional Contributor

      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