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

Create NiosII SBT (eclipse) project from cmake

Honored Contributor II

Hi people, 


I am working on a rather big project (written in C), for which I am adding a Nios2 port. From the code-side, this is already done. Next step is to generate a NiosII SBT project from my sources. The sources are organized with a cmake build system.  

I managed to modify the CMake files, such that it adds the correct .c files to the project, uses nios2-elf-gcc as compilers and sets the correct cmd-line arguments for compiling and linking.  


But what I also want to do, is to be able to debug my application from eclipse (with Nios2 SBT) on the hardware. I basically have two approaches to reach that goal: 


1) use cmake to generate an eclipse-project, which is able to debug on hardware.  

2) use cmake to just build the source-tree, export all .c files, compiler-defines, include-directories and patch an Nios2 SBT makefile with these exports.  


I couldn't finish any of the two approaches, here is why: 



- first of all, cmake can only generate c-project (with the CDT nature), but these projects are missing the Nios2 nature. I have added the Nios2 nature, by patching the .project file. Now I do have the button "debug on niosII hardware". Unfortunately, NiosII SBT expects the Makefile to be in a certain format for running the niosII specific commands, so I could not debug on niosII hardware 

- Maybe I can add a new target to cmake, which flashes the hardware by cmd-line and then starts a debugger session by command line (could someone maybe provide the commands to do that?). But this means, that I still do not have eclipse integration yet... maybe by attaching to that debugger session? 



patching the SBT makefile works quite well, but now I do not have any source files listed in my eclipse project. They are just in the makefile, but not in eclipse's Project Explorer. How could one add the files to the project explorer as well?
0 Kudos
0 Replies