Forum Discussion
Altera_Forum
Honored Contributor
11 years agoOne of the problems with my previous attempts to link the source code from the main project into the boot project is that the source code resides in the main project folder along with a Makefile. When building the boot project, the builder seems to use the wrong Makefile or at least be confused by the Makefile that exists in folder with the source code. For example, the reason my previous boot build skipped the compilation step is because object files for the source files already existed under the main project. The boot project was mistakenly referencing the main project's object files. If I cleaned the main project then the boot project would compile the source code because the main project's object files no longer existed.
So I may have found a solution, which is to put all the source code in a folder that is separate from the project folders (where the Makefiles are) When I use the New Nios II Application and BSP Template, it creates a folder structure like this .... software ........ main ............ Makefile ........ main_bsp ............ Makefile .... workspace Instead of adding my source code files to the main folder, I created a software\source folder to contain the source files. Then open the main Project Properties and under C/C++ General -> Paths and Symbols open the Source Location tab and click "Link Folder". Add the software\source folder and click "OK". Then in the Project Explorer pane, expand the linked source folder, select all the c/cpp files and select "Add to Nios II Build". Now you can build the main project using the source code from a linked folder. Next you add the boot project and link the same source folder in the same way. I also learned that you can use the New Application and BSP from Template wizard to add the boot project without also adding another BSP. Click Next within the wizard to go to the second page and click on "Select an existing BSP project from your workspace". I think it's important to use this template in my case because I'm using uc/OS-II and the template seems to add some important settings related to the RTOS. In the end my folder structure now looks like this: .... software ........ boot ............ Makefile ........ main ............ Makefile ........ main_bsp ............ Makefile ........ source ............ *.c/cpp .... workspace