Download GNAT User's Guide
Transcript
Appendix M: PikeOS Topics M.3 Building an Ada application on PikeOS using GNATbench This section will show how to use GNATbench to setup an Ada project similar to the one described in the previous section. Click on File -> New -> Others and select Ada / Ada Project. Click on next. Give demo for the project name. Click on next. Give hello for the name of the Ada main subprogram, and check the first checkbox (generate the file). Click on next. Don’t change anything for the directories settings, click on next. Check the third checkbox (Drive Build with a Makefile). Click on the scan button to refresh the names of the toolchains installed on the system, and select the powerpc-elf-pikeos toolchain (make sure that it’s the only one checked). Hit finish. A new project named demo should have been created. Open the file src/hello.adb, and paste the Ada code given in the previous section. Create a new file at the same location, last chance handler.c, and paste the corresponding code. Open the file demo/Makefile. Change the build command to: build: powerpc-elf-pikeos-gcc -c -g src/last_chance_handler.c \ -I/opt/pikeos-3.0/target/ppc/oea/include/ \ -I/opt/pikeos-3.0/target/ppc/oea/include/stand/ \ -o obj/last_chance_handler.o $(GNATMAKE) -d -P "$(GPRPATH)" -largs obj/last_chance_handler.o cp obj/hello ../kernel/target/pikeos Right-click on the project demo, from the project navigator, and select Build Current Project. Then right-click on the target directory of the kernel project and select Refresh. M.4 Running an Ada application on PikeOS PikeOS and CODEO are integrated with a simulator called QEMU. This can be a simple way to run and test a PikeOS application. In the previous sections, we have seen how to create a PikeOS kernel targeted to this simulator, embedding a simple Ada application. The following command should run this kernel on QEMU: $ /opt/pikeos-3.0/share/qemu/bin/qemu-system-ppc -M prep_bare -serial stdio -nographic no-reboot -kernel boot/pikeos-qemu-ppc-qemu PikeOS (C) Copyright 1998-2009 SYSGO AG, Germany Build: S2151-3.0-443 Arch: PowerPC OEA Platform: QEMU PPC PREP Features: RETAIL TRACER-SYSCALL KERNEL-TRACING PikeOS System Software starting. Build: S2151-3.0-151 PikeOS System Software up and running. 141