By Neil

Now minimal system is almost done, so I am trying to debug it and make it work, certainly at first step, which is debug Null Application–a dummy one.

List errors encountered when debugging and methods to solve them.

1. In NiosII command shell, at app/Null directory, input make toni (oh, TonyOS + NiosII platform, of course;));

/opt/tinyos-2.x/tos/chips/nios2/inttypes.h:4:23: alt_types.h: No such file or directory, so should add path now.

Solution for Adding Path:

a. try to edit in suport/make directory with this:

PFLAGS += -finline-limit=100000 -I../../tos/platforms/toni -I/cygdrive/C/Altera/72/nios2eds/components/altera_nios2/ HAL/inc -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_pio/inc

could fine specific files, but could not include files included by speficif files.

b. export PATH=… is not the solution, which is used for including compilers.

c. In order to include related files in systematic way, explore NiosII make files:

   c.1 try to add include path in NiosII IDE, then search it, but it appears in .cdtproject, so not the way I hope;

   c.2 The NiosII IDE use a automated discovery path method to find paths which should be included, search several times, seems no easy to implement;?????

   c.3 So I just use a stupid way to solve, which is manually add paths which appear in NiosII IDE for hello_world application.

This is the list:

PFLAGS += -I/cygdrive/C/Altera/72/quartus/bin/cygwin/lib/gcc-lib/i686-pc-cygwin/3.3.3/include
PFLAGS += -I/cygdrive/C/Altera/72/quartus/bin/cygwin/usr/include
PFLAGS += -I/cygdrive/C/Altera/72/quartus/bin/cygwin/usr/include/w32api

#application include path
PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/software
PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/software/hello_world_2_syslib/Debug/system_description
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_cfi_flash/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_epcs_flash_controller/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_epcs_flash_controller/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_jtag_uart/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_jtag_uart/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_uart/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_uart/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_timer/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_timer/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_lcd_16207/HAL/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_lcd_16207/inc
PFLAGS += -I/cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_pio/inc

PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/SEG7_LUT_8/inc
PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/DM9000A/inc
PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/ISP1362/inc
PFLAGS += -I/cygdrive/I/working/Nios/Examples/AcceRTOS/DE2_NIOS/Binary_VGA_Controller/inc

PFLAGS += -I/cgydrive/C/Altera/72/ip/nios2_ip/altera_nios2/HAL/inc
PFLAGS += -I/cgydrive/C/Altera/72/nios2eds/components/altera_hal/HAL/inc


This time , I hope it could be solved.

2. Another compiling error:

In file included from /cygdrive/C/Altera/72/ip/sopc_builder_ip/altera_avalon_pio/inc/altera_avalon_pio_regs.h:34,
                 from ../../tos/platforms/toni/hardware.h:6,
                 from /opt/tinyos-2.x/tos/system/
/cygdrive/C/Altera/72/nios2eds/components/altera_nios2/HAL/inc/io.h:45:2: #error SYSTEM_BUS_WIDTH undefined

After searching, I find that the SYSTEM_BUS_WIDTH is normally defined at in corresponding system_lib directory, in which:



From Wikipedia, the free encyclopedia

  (Redirected from CPPFLAGS)

Jump to: navigation, search

CFLAGS and CXXFLAGS are either the name of environment variables or of Makefile variables that can be set to specify additional switches to be passed to a compiler in the process of building computer software.

These variables are usually set inside a Makefile and are then appended to the command line when the compiler is invoked. If they are not specified in the Makefile, then they will be read from the environment, if present. Tools like autoconf‘s ./configure script will usually pick them up from the environment and write them into the generated Makefiles.

CFLAGS allows to add switches for the C compiler, while CXXFLAGS is meant to be used when invoking a C++ compiler. Similarly, a variable CPPFLAGS exists with switches to be passed to the C preprocessor.

These variables are most commonly used to specify optimization or debugging switches to a compiler, as for example -g, -O2 or (GCC-specific) -march=athlon.

Then I added CPPFLAGS += -DSYSTEM_BUS_WIDTH=32 to, still could not work, so I just add DSYSTEM_BUS_WIDTH definition to platform.h in platform/toni/ directory. Then solved!

3. 3rd compiling error:

In file included from /opt/tinyos-2.x/tos/system/,
                 from /opt/tinyos-2.x/tos/system/
../../tos/platforms/toni/hardware.h:21: syntax error before `1′

The line is TOSH_ASSIGN_PIN(LED_RED, 1);

Forgot to include .h file, which defines TOSH_ASSIGN_PIN.

After trace all Led related source code, it turns out that there’s no need to define TOSH_ASSIGN_PIN(LED_RED, 1); so I deleted them all. Solved!

4. 4th compiling error:

Several these kind of errors:

/usr/include/stdint.h:18: redefinition of `int8_t’
/opt/tinyos-2.x/tos/chips/nios2/inttypes.h:6: previous declaration of `int8_t’

Checking with other platform definition, no need to define this too. Delete, Solved!


5. Compile Successfully.


Next Step… on Compiling BLink!