Repository: QuantumLeaps/qpn Branch: master Commit: 779ef14dc1c7 Files: 828 Total size: 8.9 MB Directory structure: gitextract_iaujvinz/ ├── .gitignore ├── .gitmodules ├── GPLv3.txt ├── LICENSE.txt ├── README.md ├── doxygen/ │ ├── Doxyfile │ ├── Doxyfile-CHM │ ├── api.dox │ ├── exa.dox │ ├── exa_apps.dox │ ├── exa_native.dox │ ├── exa_os.dox │ ├── gs.dox │ ├── history.dox │ ├── img/ │ │ └── img.htm │ ├── lint.dox │ ├── macros.h │ ├── main.dox │ ├── make.bat │ ├── modules.dox │ ├── ports.dox │ ├── ports_arm-cm.dox │ ├── ports_native.dox │ ├── ports_os.dox │ ├── preview.js │ ├── rsm.bat │ ├── rsm_qpn.cfg │ ├── snippets/ │ │ ├── qepn_qhist.c │ │ ├── qepn_qhsm.c │ │ ├── qepn_qhsm_ctor.c │ │ ├── qepn_qhsm_use.c │ │ ├── qepn_qinit.c │ │ ├── qepn_qtran.c │ │ ├── qfn_armx.c │ │ ├── qfn_main.c │ │ ├── qfn_post.c │ │ ├── qfn_postx.c │ │ ├── qfn_qactive.c │ │ ├── qfn_tickx.c │ │ ├── qkn_lock.c │ │ └── qkn_oncontextsw.c │ └── struct.dox ├── examples/ │ ├── README.url │ ├── arm-cm/ │ │ ├── README.url │ │ ├── blinky_efm32-slstk3401a/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── blinky-qk.uvoptx │ │ │ │ │ └── blinky-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── blinky-qk.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qk.ewd │ │ │ │ ├── blinky-qk.ewp │ │ │ │ ├── blinky-qk.eww │ │ │ │ └── blinky-qk.icf │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ ├── armclang/ │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qv.uvoptx │ │ │ │ └── blinky-qv.uvprojx │ │ │ ├── bsp.c │ │ │ ├── gnu/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qv.ld │ │ │ │ └── flash.bat │ │ │ └── iar/ │ │ │ ├── README.txt │ │ │ ├── blinky-qv.ewd │ │ │ ├── blinky-qv.ewp │ │ │ ├── blinky-qv.eww │ │ │ └── blinky-qv.icf │ │ ├── blinky_ek-tm4c123gxl/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ ├── arm/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── blinky-qk.uvoptx │ │ │ │ │ └── blinky-qk.uvprojx │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── blinky-qk.uvoptx │ │ │ │ │ └── blinky-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .ccsproject │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── blinky-qk.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qk.ewd │ │ │ │ ├── blinky-qk.ewp │ │ │ │ ├── blinky-qk.eww │ │ │ │ └── blinky-qk.icf │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ ├── arm/ │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qv.uvoptx │ │ │ │ └── blinky-qv.uvprojx │ │ │ ├── armclang/ │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qv.uvoptx │ │ │ │ └── blinky-qv.uvprojx │ │ │ ├── bsp.c │ │ │ ├── gnu/ │ │ │ │ ├── .ccsproject │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── blinky-qv.ld │ │ │ │ └── flash.bat │ │ │ └── iar/ │ │ │ ├── README.txt │ │ │ ├── blinky-qv.ewd │ │ │ ├── blinky-qv.ewp │ │ │ ├── blinky-qv.eww │ │ │ └── blinky-qv.icf │ │ ├── dpp_efm32-slstk3401a/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── dpp-qk.ewd │ │ │ │ ├── dpp-qk.ewp │ │ │ │ ├── dpp-qk.eww │ │ │ │ └── dpp-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── dpp-qv.ewd │ │ │ │ ├── dpp-qv.ewp │ │ │ │ ├── dpp-qv.eww │ │ │ │ └── dpp-qv.icf │ │ │ ├── table.c │ │ │ └── win32-gui/ │ │ │ ├── Resource.rc │ │ │ ├── bsp.c │ │ │ ├── dpp-gui.sln │ │ │ ├── dpp-gui.vcxproj │ │ │ ├── dpp-gui.vcxproj.filters │ │ │ └── resource.h │ │ ├── dpp_ek-tm4c123gxl/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── lint-plus/ │ │ │ │ ├── README.txt │ │ │ │ ├── lin.bat │ │ │ │ └── options.lnt │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ ├── arm/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .ccsproject │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── dpp-qk.ewd │ │ │ │ ├── dpp-qk.ewp │ │ │ │ ├── dpp-qk.eww │ │ │ │ └── dpp-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── arm/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .ccsproject │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.ld │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── dpp-qv.ewd │ │ │ │ ├── dpp-qv.ewp │ │ │ │ ├── dpp-qv.eww │ │ │ │ └── dpp-qv.icf │ │ │ └── table.c │ │ ├── dpp_mbed-lpc1768/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ └── dpp-qk.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qk.ewd │ │ │ │ ├── dpp-qk.ewp │ │ │ │ ├── dpp-qk.eww │ │ │ │ └── dpp-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ └── dpp-qv.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qv.ewd │ │ │ │ ├── dpp-qv.ewp │ │ │ │ ├── dpp-qv.eww │ │ │ │ └── dpp-qv.icf │ │ │ └── table.c │ │ ├── dpp_nucleo-l053r8/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── dpp-qk.ld │ │ │ │ │ ├── dpp-qk_nucleo-l053r8.elf.launch │ │ │ │ │ └── stm32_flash.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qk.ewd │ │ │ │ ├── dpp-qk.ewp │ │ │ │ ├── dpp-qk.eww │ │ │ │ └── dpp-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ └── dpp-qv.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qv.ewd │ │ │ │ ├── dpp-qv.ewp │ │ │ │ ├── dpp-qv.eww │ │ │ │ └── dpp-qv.icf │ │ │ └── table.c │ │ ├── dpp_nucleo-l152re/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qk.uvoptx │ │ │ │ │ └── dpp-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ └── dpp-qk.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qk.ewd │ │ │ │ ├── dpp-qk.ewp │ │ │ │ ├── dpp-qk.eww │ │ │ │ └── dpp-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── dpp-qv.uvoptx │ │ │ │ │ └── dpp-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ ├── Makefile │ │ │ │ │ └── dpp-qv.ld │ │ │ │ └── iar/ │ │ │ │ ├── dpp-qv.ewd │ │ │ │ ├── dpp-qv.ewp │ │ │ │ ├── dpp-qv.eww │ │ │ │ └── dpp-qv.icf │ │ │ └── table.c │ │ ├── game_efm32-slstk3401a/ │ │ │ ├── README.txt │ │ │ ├── README.url │ │ │ ├── bsp.h │ │ │ ├── game.h │ │ │ ├── game.qm │ │ │ ├── main.c │ │ │ ├── mine1.c │ │ │ ├── mine2.c │ │ │ ├── missile.c │ │ │ ├── qk/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── game-qk.uvoptx │ │ │ │ │ └── game-qk.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── flash.bat │ │ │ │ │ └── game-qk.ld │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── game-qk.ewd │ │ │ │ ├── game-qk.ewp │ │ │ │ ├── game-qk.eww │ │ │ │ └── game-qk.icf │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ ├── armclang/ │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── game-qv.uvoptx │ │ │ │ │ └── game-qv.uvprojx │ │ │ │ ├── bsp.c │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── flash.bat │ │ │ │ │ └── game-qv.ld │ │ │ │ └── iar/ │ │ │ │ ├── README.txt │ │ │ │ ├── game-qv.ewd │ │ │ │ ├── game-qv.ewp │ │ │ │ ├── game-qv.eww │ │ │ │ └── game-qv.icf │ │ │ ├── ship.c │ │ │ ├── tunnel.c │ │ │ └── win32-gui/ │ │ │ ├── Resource.rc │ │ │ ├── bsp.c │ │ │ ├── game-gui.sln │ │ │ ├── game-gui.vcxproj │ │ │ ├── game-gui.vcxproj.filters │ │ │ └── resource.h │ │ └── pelican_ek-tm4c123gxl/ │ │ ├── README.url │ │ ├── bsp.h │ │ ├── main.c │ │ ├── pelican.c │ │ ├── pelican.h │ │ ├── pelican.qm │ │ ├── qk/ │ │ │ ├── armclang/ │ │ │ │ ├── README.txt │ │ │ │ ├── pelican-qk.uvoptx │ │ │ │ └── pelican-qk.uvprojx │ │ │ ├── bsp.c │ │ │ ├── gnu/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── flash.bat │ │ │ │ └── pelican-qk.ld │ │ │ └── iar/ │ │ │ ├── README.txt │ │ │ ├── pelican-qk.ewd │ │ │ ├── pelican-qk.ewp │ │ │ ├── pelican-qk.eww │ │ │ └── pelican-qk.icf │ │ ├── qpn_conf.h │ │ └── qv/ │ │ ├── armclang/ │ │ │ ├── README.txt │ │ │ ├── pelican-qv.uvoptx │ │ │ └── pelican-qv.uvprojx │ │ ├── bsp.c │ │ ├── gnu/ │ │ │ ├── Makefile │ │ │ ├── README.txt │ │ │ ├── flash.bat │ │ │ └── pelican-qv.ld │ │ └── iar/ │ │ ├── README.txt │ │ ├── pelican-qv.ewd │ │ ├── pelican-qv.ewp │ │ ├── pelican-qv.eww │ │ └── pelican-qv.icf │ ├── arm7-9/ │ │ ├── README.url │ │ └── dpp_at91sam7s-ek/ │ │ ├── README.url │ │ ├── bsp.h │ │ ├── dpp.h │ │ ├── dpp.qm │ │ ├── main.c │ │ ├── philo.c │ │ ├── qk/ │ │ │ └── iar/ │ │ │ ├── at91SAM7S64.icf │ │ │ ├── bsp.c │ │ │ ├── dpp-qk.ewd │ │ │ ├── dpp-qk.ewp │ │ │ └── dpp-qk.eww │ │ ├── qpn_conf.h │ │ ├── qv/ │ │ │ └── iar/ │ │ │ ├── at91SAM7S64.icf │ │ │ ├── bsp.c │ │ │ ├── dpp-qv.ewd │ │ │ ├── dpp-qv.ewp │ │ │ └── dpp-qv.eww │ │ └── table.c │ ├── avr/ │ │ ├── README.url │ │ ├── blinky_arduino-uno/ │ │ │ ├── README.url │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ ├── gnu/ │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── bsp.c │ │ │ │ │ └── flash.bat │ │ │ │ └── iar/ │ │ │ │ ├── blinky-qk.ewd │ │ │ │ ├── blinky-qk.ewp │ │ │ │ ├── blinky-qk.eww │ │ │ │ ├── bsp.c │ │ │ │ └── flash.bat │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ ├── gnu/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── bsp.c │ │ │ │ └── flash.bat │ │ │ └── iar/ │ │ │ ├── blinky-qv.ewd │ │ │ ├── blinky-qv.ewp │ │ │ ├── blinky-qv.eww │ │ │ ├── bsp.c │ │ │ └── flash.bat │ │ └── dpp_arduino-uno/ │ │ ├── README.url │ │ ├── bsp.h │ │ ├── dpp.h │ │ ├── dpp.qm │ │ ├── main.c │ │ ├── philo.c │ │ ├── qk/ │ │ │ ├── gnu/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── bsp.c │ │ │ │ └── flash.bat │ │ │ └── iar/ │ │ │ ├── README.txt │ │ │ ├── bsp.c │ │ │ ├── dpp-qk.ewd │ │ │ ├── dpp-qk.ewp │ │ │ ├── dpp-qk.eww │ │ │ ├── flash.bat │ │ │ └── spy.bat │ │ ├── qpn_conf.h │ │ ├── qv/ │ │ │ ├── gnu/ │ │ │ │ ├── Makefile │ │ │ │ ├── README.txt │ │ │ │ ├── bsp.c │ │ │ │ ├── flash.bat │ │ │ │ └── spy.bat │ │ │ └── iar/ │ │ │ ├── README.txt │ │ │ ├── bsp.c │ │ │ ├── dpp-qv.ewd │ │ │ ├── dpp-qv.ewp │ │ │ ├── dpp-qv.eww │ │ │ ├── flash.bat │ │ │ └── spy.bat │ │ └── table.c │ ├── msp430/ │ │ ├── README.url │ │ ├── blinky_msp-exp430f5529lp/ │ │ │ ├── README.url │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ ├── bsp.c │ │ │ │ ├── ccs/ │ │ │ │ │ ├── .ccsproject │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── lnk_msp430f5529.cmd │ │ │ │ └── iar/ │ │ │ │ ├── blinky-qk.ewd │ │ │ │ ├── blinky-qk.ewp │ │ │ │ └── blinky-qk.eww │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ ├── bsp.c │ │ │ ├── ccs/ │ │ │ │ ├── .ccsproject │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── lnk_msp430f5529.cmd │ │ │ └── iar/ │ │ │ ├── blinky-qv.ewd │ │ │ ├── blinky-qv.ewp │ │ │ └── blinky-qv.eww │ │ ├── blinky_msp-exp430g2/ │ │ │ ├── README.url │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ ├── bsp.c │ │ │ │ ├── ccs/ │ │ │ │ │ ├── .ccsproject │ │ │ │ │ ├── .cproject │ │ │ │ │ ├── .project │ │ │ │ │ └── lnk_msp430g2553.cmd │ │ │ │ └── iar/ │ │ │ │ ├── blinky-qk.ewd │ │ │ │ ├── blinky-qk.ewp │ │ │ │ └── blinky-qk.eww │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ ├── bsp.c │ │ │ ├── ccs/ │ │ │ │ ├── .ccsproject │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── lnk_msp430g2553.cmd │ │ │ └── iar/ │ │ │ ├── blinky-qv.ewd │ │ │ ├── blinky-qv.ewp │ │ │ └── blinky-qv.eww │ │ └── dpp_msp-exp430g2/ │ │ ├── README.url │ │ ├── bsp.h │ │ ├── dpp.h │ │ ├── dpp.qm │ │ ├── main.c │ │ ├── philo.c │ │ ├── qk/ │ │ │ ├── bsp.c │ │ │ ├── ccs/ │ │ │ │ ├── .ccsproject │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── lnk_msp430g2553.cmd │ │ │ └── iar/ │ │ │ ├── dpp-qk.ewd │ │ │ ├── dpp-qk.ewp │ │ │ └── dpp-qk.eww │ │ ├── qpn_conf.h │ │ ├── qv/ │ │ │ ├── bsp.c │ │ │ ├── ccs/ │ │ │ │ ├── .ccsproject │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ └── lnk_msp430g2553.cmd │ │ │ └── iar/ │ │ │ ├── dpp-qv.ewd │ │ │ ├── dpp-qv.ewp │ │ │ └── dpp-qv.eww │ │ └── table.c │ ├── pic24_dspic/ │ │ ├── blinky_microstick2-pic24/ │ │ │ ├── blinky.c │ │ │ ├── blinky.h │ │ │ ├── bsp.h │ │ │ ├── main.c │ │ │ ├── qk/ │ │ │ │ └── xc16/ │ │ │ │ ├── Makefile │ │ │ │ ├── bsp.c │ │ │ │ └── nbproject/ │ │ │ │ ├── Makefile-default.mk │ │ │ │ ├── Makefile-genesis.properties │ │ │ │ ├── Makefile-impl.mk │ │ │ │ ├── Makefile-local-default.mk │ │ │ │ ├── Makefile-local-release.mk │ │ │ │ ├── Makefile-release.mk │ │ │ │ ├── Makefile-variables.mk │ │ │ │ ├── Package-default.bash │ │ │ │ ├── Package-release.bash │ │ │ │ ├── configurations.xml │ │ │ │ ├── private/ │ │ │ │ │ ├── configurations.xml │ │ │ │ │ ├── private.properties │ │ │ │ │ └── private.xml │ │ │ │ ├── project.properties │ │ │ │ └── project.xml │ │ │ ├── qpn_conf.h │ │ │ └── qv/ │ │ │ └── xc16/ │ │ │ ├── Makefile │ │ │ ├── bsp.c │ │ │ └── nbproject/ │ │ │ ├── Makefile-default.mk │ │ │ ├── Makefile-genesis.properties │ │ │ ├── Makefile-impl.mk │ │ │ ├── Makefile-local-default.mk │ │ │ ├── Makefile-local-release.mk │ │ │ ├── Makefile-release.mk │ │ │ ├── Makefile-variables.mk │ │ │ ├── Package-default.bash │ │ │ ├── Package-release.bash │ │ │ ├── configurations.xml │ │ │ ├── private/ │ │ │ │ ├── configurations.xml │ │ │ │ ├── private.properties │ │ │ │ └── private.xml │ │ │ ├── project.properties │ │ │ └── project.xml │ │ ├── dpp_microstick2-pic24/ │ │ │ ├── bsp.h │ │ │ ├── dpp.h │ │ │ ├── dpp.qm │ │ │ ├── main.c │ │ │ ├── philo.c │ │ │ ├── qk/ │ │ │ │ └── xc16/ │ │ │ │ ├── Makefile │ │ │ │ ├── bsp.c │ │ │ │ └── nbproject/ │ │ │ │ ├── Makefile-default.mk │ │ │ │ ├── Makefile-genesis.properties │ │ │ │ ├── Makefile-impl.mk │ │ │ │ ├── Makefile-local-default.mk │ │ │ │ ├── Makefile-local-release.mk │ │ │ │ ├── Makefile-release.mk │ │ │ │ ├── Makefile-variables.mk │ │ │ │ ├── Package-default.bash │ │ │ │ ├── Package-release.bash │ │ │ │ ├── configurations.xml │ │ │ │ ├── private/ │ │ │ │ │ ├── configurations.xml │ │ │ │ │ ├── private.properties │ │ │ │ │ └── private.xml │ │ │ │ ├── project.properties │ │ │ │ └── project.xml │ │ │ ├── qpn_conf.h │ │ │ ├── qv/ │ │ │ │ └── xc16/ │ │ │ │ ├── Makefile │ │ │ │ ├── bsp.c │ │ │ │ └── nbproject/ │ │ │ │ ├── Makefile-default.mk │ │ │ │ ├── Makefile-genesis.properties │ │ │ │ ├── Makefile-impl.mk │ │ │ │ ├── Makefile-local-default.mk │ │ │ │ ├── Makefile-local-release.mk │ │ │ │ ├── Makefile-release.mk │ │ │ │ ├── Makefile-variables.mk │ │ │ │ ├── Package-default.bash │ │ │ │ ├── Package-release.bash │ │ │ │ ├── configurations.xml │ │ │ │ ├── private/ │ │ │ │ │ ├── configurations.xml │ │ │ │ │ ├── private.properties │ │ │ │ │ └── private.xml │ │ │ │ ├── project.properties │ │ │ │ └── project.xml │ │ │ └── table.c │ │ └── pelican_microstick2-pic24/ │ │ ├── bsp.h │ │ ├── main.c │ │ ├── pelican.c │ │ ├── pelican.h │ │ ├── pelican.qm │ │ ├── qk/ │ │ │ └── xc16/ │ │ │ ├── Makefile │ │ │ ├── bsp.c │ │ │ └── nbproject/ │ │ │ ├── Makefile-default.mk │ │ │ ├── Makefile-genesis.properties │ │ │ ├── Makefile-impl.mk │ │ │ ├── Makefile-local-default.mk │ │ │ ├── Makefile-local-release.mk │ │ │ ├── Makefile-release.mk │ │ │ ├── Makefile-variables.mk │ │ │ ├── Package-default.bash │ │ │ ├── Package-release.bash │ │ │ ├── configurations.xml │ │ │ ├── private/ │ │ │ │ ├── configurations.xml │ │ │ │ ├── private.properties │ │ │ │ └── private.xml │ │ │ ├── project.properties │ │ │ └── project.xml │ │ ├── qpn_conf.h │ │ └── qv/ │ │ └── xc16/ │ │ ├── Makefile │ │ ├── bsp.c │ │ └── nbproject/ │ │ ├── Makefile-default.mk │ │ ├── Makefile-genesis.properties │ │ ├── Makefile-impl.mk │ │ ├── Makefile-local-default.mk │ │ ├── Makefile-local-release.mk │ │ ├── Makefile-release.mk │ │ ├── Makefile-variables.mk │ │ ├── Package-default.bash │ │ ├── Package-release.bash │ │ ├── configurations.xml │ │ ├── private/ │ │ │ ├── configurations.xml │ │ │ ├── private.properties │ │ │ └── private.xml │ │ ├── project.properties │ │ └── project.xml │ └── workstation/ │ ├── README.txt │ ├── blinky/ │ │ ├── Makefile │ │ ├── README.txt │ │ ├── blinky.c │ │ ├── blinky.qm │ │ └── qpn_conf.h │ ├── calc/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── calc.c │ │ ├── calc.h │ │ ├── calc.qm │ │ ├── main.c │ │ └── qpn_conf.h │ ├── comp/ │ │ ├── Makefile │ │ ├── alarm.c │ │ ├── alarm.h │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── clock.h │ │ ├── comp.c │ │ ├── main.c │ │ └── qpn_conf.h │ ├── defer/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── defer.c │ │ ├── defer.h │ │ ├── main.c │ │ └── qpn_conf.h │ ├── dpp/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── dpp.h │ │ ├── dpp.qm │ │ ├── dpp.sln │ │ ├── dpp.vcxproj │ │ ├── dpp.vcxproj.filters │ │ ├── main.c │ │ ├── philo.c │ │ ├── qpn_conf.h │ │ └── table.c │ ├── dpp-comp/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── dpp.h │ │ ├── dpp.sln │ │ ├── dpp.vcxproj │ │ ├── dpp.vcxproj.filters │ │ ├── dpp_comp.qm │ │ ├── main.c │ │ ├── philo.c │ │ ├── qpn_conf.h │ │ └── table.c │ ├── dpp-gui/ │ │ └── README.txt │ ├── game-gui/ │ │ └── README.txt │ ├── history/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── history.c │ │ ├── history.h │ │ ├── history.qm │ │ ├── main.c │ │ └── qpn_conf.h │ ├── pelican/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── main.c │ │ ├── pelican.c │ │ ├── pelican.h │ │ ├── pelican.qm │ │ └── qpn_conf.h │ ├── qhsmtst/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── log.txt │ │ ├── main.c │ │ ├── qhsmtst.c │ │ ├── qhsmtst.h │ │ ├── qhsmtst.qm │ │ └── qpn_conf.h │ ├── reminder/ │ │ ├── Makefile │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── main.c │ │ ├── qpn_conf.h │ │ ├── reminder.c │ │ └── reminder.h │ └── reminder2/ │ ├── Makefile │ ├── bsp.c │ ├── bsp.h │ ├── main.c │ ├── qpn_conf.h │ ├── reminder2.c │ └── reminder2.h ├── include/ │ ├── qassert.h │ ├── qepn.h │ ├── qfn.h │ ├── qkn.h │ ├── qpn.h │ ├── qstamp.c │ └── qvn.h ├── ports/ │ ├── README.url │ ├── arm-cm/ │ │ ├── README.url │ │ ├── qk/ │ │ │ ├── arm/ │ │ │ │ ├── qfn_port.h │ │ │ │ └── qkn_port.c │ │ │ ├── armclang/ │ │ │ │ ├── qfn_port.h │ │ │ │ └── qkn_port.c │ │ │ ├── gnu/ │ │ │ │ ├── qfn_port.h │ │ │ │ └── qkn_port.c │ │ │ └── iar/ │ │ │ ├── qfn_port.h │ │ │ └── qkn_port.c │ │ └── qv/ │ │ ├── arm/ │ │ │ ├── qfn_port.h │ │ │ └── qvn_port.c │ │ ├── armclang/ │ │ │ ├── qfn_port.h │ │ │ └── qvn_port.c │ │ ├── gnu/ │ │ │ ├── qfn_port.h │ │ │ └── qvn_port.c │ │ └── iar/ │ │ ├── qfn_port.h │ │ └── qvn_port.c │ ├── arm7-9/ │ │ ├── README.url │ │ ├── qk/ │ │ │ ├── README.url │ │ │ ├── gnu/ │ │ │ │ ├── qfn_port.h │ │ │ │ └── qkn_port.s │ │ │ └── iar/ │ │ │ ├── qfn_port.h │ │ │ └── qkn_port.s │ │ └── qv/ │ │ ├── README.url │ │ ├── gnu/ │ │ │ ├── qfn_port.h │ │ │ └── qvn_port.s │ │ └── iar/ │ │ ├── qfn_port.h │ │ └── qvn_port.s │ ├── avr/ │ │ ├── README.txt │ │ ├── README.url │ │ ├── qk/ │ │ │ ├── gnu/ │ │ │ │ ├── README.txt │ │ │ │ └── qfn_port.h │ │ │ └── iar/ │ │ │ └── qfn_port.h │ │ └── qv/ │ │ ├── gnu/ │ │ │ ├── README.txt │ │ │ └── qfn_port.h │ │ └── iar/ │ │ └── qfn_port.h │ ├── lint-plus/ │ │ ├── 16bit/ │ │ │ ├── cpu.lnt │ │ │ └── stdint.h │ │ ├── 32bit/ │ │ │ ├── cpu.lnt │ │ │ └── stdint.h │ │ ├── au-ds.lnt │ │ ├── au-misra3-amd1.lnt │ │ ├── au-misra3.lnt │ │ ├── lin.bat │ │ ├── options.lnt │ │ ├── qkn/ │ │ │ └── qfn_port.h │ │ ├── qpn.lnt │ │ ├── qpn_conf.h │ │ ├── qvn/ │ │ │ └── qfn_port.h │ │ ├── std.lnt │ │ └── stdbool.h │ ├── msp430/ │ │ ├── README.txt │ │ ├── README.url │ │ ├── qk/ │ │ │ ├── ccs/ │ │ │ │ ├── README.txt │ │ │ │ └── qfn_port.h │ │ │ └── iar/ │ │ │ └── qfn_port.h │ │ └── qv/ │ │ ├── ccs/ │ │ │ ├── README.txt │ │ │ └── qfn_port.h │ │ └── iar/ │ │ └── qfn_port.h │ ├── pic24_dspic/ │ │ ├── qk/ │ │ │ └── xc16/ │ │ │ ├── qfn_port.h │ │ │ └── qkn_port.c │ │ └── qv/ │ │ └── xc16/ │ │ └── qfn_port.h │ ├── posix-qv/ │ │ ├── README.url │ │ ├── qfn_port.h │ │ ├── qfn_posix.c │ │ └── safe_std.h │ └── win32-qv/ │ ├── README.url │ ├── qfn_port.h │ ├── qfn_win32.c │ ├── qwin_gui.c │ ├── qwin_gui.h │ └── safe_std.h └── src/ ├── qfn/ │ ├── qepn.c │ └── qfn.c ├── qkn/ │ └── qkn.c └── qvn/ └── qvn.c ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.obj *.o *.d *.lib *.a *.elf *.err *.hex *.exe *.EXE *.map *.dep *.pdf *.PDF *.Hbp *.nav *.tps *.tws *.tmp *.log *.chm *.zip *.pdb *.ncb *.suo *.chw *.sfr *.ewt *.user *.avrsuo *.Debug *.Release lint*.txt *.Miro *.bak *.qlc JLink*.* version-* metrics.dox html/ test_priv/ dbg/ rel/ spy/ build/ build_rel/ build_spy/ settings/ .settings/ targetConfigs/ Debug/ Release/ lib/ obj/ output/ ================================================ FILE: .gitmodules ================================================ [submodule "3rd_party"] path = 3rd_party url = https://github.com/QuantumLeaps/3rd_party-qpn.git ================================================ FILE: GPLv3.txt ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: LICENSE.txt ================================================ The QP-nano Real-Time Embedded Framework (RTEF) is licensed under the dual-licensing model, in which both the open source and traditional closed source software distribution models are combined. For more information, please see: https://www.state-machine.com/licensing **** NOTE: If your company has a policy forbidding open source in your product, all QP frameworks can be licensed commercially, in which case you don't use any open source license and you do not violate your policy. **** Contact Information: ==================== - https://www.state-machine.com - mailto:info@state-machine.com ================================================ FILE: README.md ================================================ ![QP-nano framework](https://www.state-machine.com/img/qpn_banner.jpg) --------------------------------------------------------------------------- # What's New? **NOTE:** QP-nano has been **discontinued** from active development and support and is **not recommended** for new designs. This QP-nano repository is preserved for the existing user base. **LICENSING:** If you are interested in commercial licensing QP-nano, please refer to section [QP-nano Licensing](#qp-nano-licensing). **QM Tool Compatibility:** The last QM version that supports code generation for QP-nano is [QM 5.2.3 released on 2022-11-18](https://www.state-machine.com/qm/history.html#qm_5_2_3). Newer QM versions no longer support QP-nano. # Documentation The offline HTML documentation for **this** particular version of QP-nano is located in the folder html/. To view the offline documentation, open the file html/index.html in your web browser. The online HTML documention for the **latest** version of QP-nano is located at: https://www.state-machine.com/qpn/ # About QP-nano QP-nano (Quantum Platform Nano) is an ultra-lightweight, open source [Real-Time Embedded Framework (RTEF)][RTEF] for building modern embedded software as systems of asynchronous, event-driven [active objects][Active] (actors). The [QP-nano] framework is a member of a larger [QP] family consisting of [QP/C], [QP/C++], and [QP-nano] frameworks, which are all strictly quality controlled, thoroughly documented, and [commercially licensable][Lic]. ## Safer Model of Concurrency The [QP] framework family is based on the [Active Object][Active] (**actor**) design pattern, which inherently supports and automatically enforces the following best practices of concurrent programming: - Keep data isolated and bound to active objects' threads. Threads should hide (**encapsulate**) their private data and other resources, and not share them with the rest of the system. - Communicate among active object threads **asynchronously** via event objects. Using asynchronous events keeps the threads running truly independently, **without blocking** on each other. - Active object threads should spend their lifetime responding to incoming events, so their mainline should consist of an **event-loop** that handles events one at a time (to completion), thus avoiding any concurrency hazards within an active object thread itself. This architecture is generally **safer**, more responsive and easier to understand and maintain than the shared-state concurrency of a conventional RTOS. It also provides higher level of abstraction and the *correct* abstractions to effectively apply **modeling** and **code generation** to deeply embedded real-time systems. ## Hierarchical State Machines The behavior of active objects is specified in QP-nano by means of [Hierarchical State Machines][HSM] (UML statecharts). The framework supports manual coding of UML state machines in C as well as automatic **code generation** by means of the free [QM modeling tool][QM]. ## Built-in Real-Time Kernels The QP-nano framework can run on bare-metal single-chip microcontrollers, completely replacing a traditional "superloop" or an RTOS. The framework contains a selection of **built-in real-time kernels**, such as the cooperative QV-nano kernel and the preemptive non-blocking QK-nano kernel. Native QP-nano ports and ready-to-use examples are provided for such CPUs MSP430, AVRmega, and ARM Cortex-M (M0/M0+/M3/M4). ## Maturity With 60,000 downloads a year, the [QP] family is the most popular such solution on the embedded software market. It provides a modern, reusable architecture for embedded applications, which combines the active-object model of concurrency with hierarchical state machines. # Getting Started with QP-nano The [QP-nano Reference Manual](https://www.state-machine.com/qpn/) provides instructions on how to download, install, and get started with QP-nano quickly. The [AppNote: "Getting Started with QP-nano"][AN] contains also a tutorial, in which you build a simple "Blinky" application. # QP-nano Licensing QP-nano is licensed under the [dual licensing model](https://www.state-machine.com/licensing), in which both the open source software distribution mechanism and traditional closed source software distribution models are combined. > **NOTE:** Even though QP-nano has been discontinued, Quantum Leaps will continue to provide commercial licenses for QP-nano to customers still interested in deploying QP-nano in closed-source products. These commercial licenses will NOT provide technical support and will be discounted accordingly. # QP-nano Documentation The **QP-nano Manual** is located online at: https://www.state-machine.com/qpn # 3rd-Party QP-nano Ports/Adaptations [QPN-PIC16](https://github.com/aschatte/qpn) is an adaptation of the QP-nano framework to the [Microchip PIC16](https://www.microchip.com/en-us/products/microcontrollers-and-microprocessors/8-bit-mcus/pic-mcus) architecture as compiled by the MPALB-X IDE using the XC8 compiler (C90/C99). It allows QP-nano models developed using the QM modeling tool to be integrated with the QV-nano kernel to build [Active Object](https://www.state-machine.com/active-object) applications. The very limited resources of the PIC16 family of MCUs, primarily the hardware stack, required a special version of QP-nano and a QM-Modeler editing post-processor, `QM2HSM.exe`, to effect. # How to get help? - [Free Support Forum](https://sourceforge.net/p/qpc/discussion/668726) - [Bug Reports](https://sourceforge.net/p/qpc/bugs/) - [Feature Requests](https://sourceforge.net/p/qpc/feature-requests/) - [Quantum Leaps website](https://www.state-machine.com) - [Quantum Leaps licensing](https://www.state-machine.com/licensing) - [info@state-machine.com](mailto:info@state-machine.com) [RTEF]: [QP]: [QP/C]: [QP/C++]: [QP-nano]: [QM]: [Active]: [HSM]: [Lic]: [AN]: ================================================ FILE: doxygen/Doxyfile ================================================ # Doxyfile 1.9.4 @INCLUDE = ../../ql-doxygen/ql-doxyfile #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = "QP-nano" PROJECT_NUMBER = "6.9.0" PROJECT_BRIEF = "Real-Time Embedded Framework" PROJECT_LOGO = ../../ql-doxygen/images/logo_ql.png OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO CREATE_SUBDIRS_LEVEL = 6 ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = NO ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES JAVADOC_BANNER = NO QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO PYTHON_DOCSTRING = YES INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 4 OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO OPTIMIZE_OUTPUT_SLICE = NO EXTENSION_MAPPING = lnt=Objective-C MARKDOWN_SUPPORT = YES TOC_INCLUDE_HEADINGS = 4 AUTOLINK_SUPPORT = YES BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO SIP_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO GROUP_NESTED_COMPOUNDS = NO SUBGROUPING = YES INLINE_GROUPED_CLASSES = YES INLINE_SIMPLE_STRUCTS = YES TYPEDEF_HIDES_STRUCT = YES LOOKUP_CACHE_SIZE = 0 NUM_PROC_THREADS = 1 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_PRIV_VIRTUAL = NO EXTRACT_PACKAGE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO RESOLVE_UNNAMED_PARAMS = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = NO HIDE_SCOPE_NAMES = YES HIDE_COMPOUND_REFERENCE= NO SHOW_HEADERFILE = YES SHOW_INCLUDE_FILES = YES SHOW_GROUPED_MEMB_INC = NO FORCE_LOCAL_INCLUDES = NO INLINE_INFO = YES SORT_MEMBER_DOCS = NO SORT_BRIEF_DOCS = NO SORT_MEMBERS_CTORS_1ST = NO SORT_GROUP_NAMES = NO SORT_BY_SCOPE_NAME = NO STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = QPN MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_FILES = YES SHOW_NAMESPACES = YES FILE_VERSION_FILTER = LAYOUT_FILE = CITE_BIB_FILES = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_IF_INCOMPLETE_DOC = YES WARN_NO_PARAMDOC = NO WARN_AS_ERROR = NO WARN_FORMAT = "$file:$line: $text" WARN_LINE_FORMAT = "at line $line of file $file" WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- INPUT = main.dox \ gs.dox \ struct.dox \ api.dox \ exa.dox \ exa_apps.dox \ exa_native.dox \ exa_os.dox \ ports.dox \ ports_native.dox \ ports_arm-cm.dox \ ports_os.dox \ history.dox \ macros.h \ ../../ql-doxygen/help.dox \ metrics.dox \ modules.dox \ ../include \ ../src INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.dox \ *.h \ *.hpp \ *.c \ *.cpp \ *.s \ *.asm \ *.lnt RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXCLUDE_SYMBOLS = QP_IMPL EXAMPLE_PATH = snippets \ ../include \ ../src \ ../ports \ ../examples EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO IMAGE_PATH = images \ ../../ql-doxygen/images INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = NO REFERENCES_RELATION = NO REFERENCES_LINK_SOURCE = YES SOURCE_TOOLTIPS = YES USE_HTAGS = NO VERBATIM_HEADERS = YES CLANG_ASSISTED_PARSING = NO CLANG_ADD_INC_PATHS = YES CLANG_OPTIONS = CLANG_DATABASE_PATH = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = ../html HTML_FILE_EXTENSION = .html HTML_HEADER = ../../ql-doxygen/ql-header-awesome.html HTML_FOOTER = ../../ql-doxygen/ql-footer-awesome.html HTML_STYLESHEET = HTML_EXTRA_STYLESHEET = ../../ql-doxygen/doxygen-awesome.css \ ../../ql-doxygen/doxygen-awesome-sidebar-only.css \ ../../ql-doxygen/doxygen-awesome-sidebar-only-darkmode-toggle.css \ ../../ql-doxygen/ql-awesome.css HTML_EXTRA_FILES = ../../ql-doxygen/doxygen-awesome-darkmode-toggle.js \ ../../ql-doxygen/doxygen-awesome-fragment-copy-button.js \ ../../ql-doxygen/doxygen-awesome-paragraph-link.js \ ../../ql-doxygen/ql-preview.js HTML_COLORSTYLE_HUE = 209 HTML_COLORSTYLE_SAT = 255 HTML_COLORSTYLE_GAMMA = 113 HTML_TIMESTAMP = NO HTML_DYNAMIC_MENUS = YES HTML_DYNAMIC_SECTIONS = NO HTML_INDEX_NUM_ENTRIES = 100 GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" DOCSET_FEEDURL = DOCSET_BUNDLE_ID = com.state-machine.doc DOCSET_PUBLISHER_ID = com.state-machine.doc DOCSET_PUBLISHER_NAME = QuantumLeaps GENERATE_HTMLHELP = NO CHM_FILE = ../qpn.chm HHC_LOCATION = GENERATE_CHI = NO CHM_INDEX_ENCODING = BINARY_TOC = YES TOC_EXPAND = NO GENERATE_QHP = NO QCH_FILE = QHP_NAMESPACE = com.state-machine.qp QHP_VIRTUAL_FOLDER = doc QHP_CUST_FILTER_NAME = QHP_CUST_FILTER_ATTRS = QHP_SECT_FILTER_ATTRS = QHG_LOCATION = GENERATE_ECLIPSEHELP = NO ECLIPSE_DOC_ID = com.state-machine.qp DISABLE_INDEX = NO GENERATE_TREEVIEW = YES FULL_SIDEBAR = NO ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 335 EXT_LINKS_IN_WINDOW = NO OBFUSCATE_EMAILS = NO HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES FORMULA_MACROFILE = USE_MATHJAX = NO MATHJAX_VERSION = MathJax_2 MATHJAX_FORMAT = HTML-CSS MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 MATHJAX_EXTENSIONS = MATHJAX_CODEFILE = SEARCHENGINE = YES SERVER_BASED_SEARCH = NO EXTERNAL_SEARCH = NO SEARCHENGINE_URL = SEARCHDATA_FILE = searchdata.xml EXTERNAL_SEARCH_ID = QPN EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = Q_PARAM_SIZE=2 \ QF_TIMEEVT_CTR_SIZE=2 \ QF_TIMEEVT_PERIODIC \ QF_TIMEEVT_USAGE \ QK_SCHED_LOCK \ QK_ON_CONTEXT_SW EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES ================================================ FILE: doxygen/Doxyfile-CHM ================================================ # Doxyfile 1.9.2 @INCLUDE = Doxyfile #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- HTML_OUTPUT = tmp HTML_HEADER = ../../ql-doxygen/header.html HTML_FOOTER = ../../ql-doxygen/footer.html HTML_EXTRA_STYLESHEET = ../../ql-doxygen/ql.css \ ../../ql-doxygen/preview.js HTML_EXTRA_FILES = GENERATE_HTMLHELP = YES ================================================ FILE: doxygen/api.dox ================================================ /*! @page api API Reference @tableofcontents @section api_qepn QEP-nano (Hierarchical State Machines) QEP is a universal, UML-compliant event processor that enables developers to code UML state machines in highly readable ANSI-C, in which every state machine element is mapped to code precisely, unambiguously, and exactly once (traceability). QEP fully supports hierarchical state nesting, which is the fundamental mechanism for reusing behavior across many states instead of repeating the same actions and transitions over and over again. @subsection api_qep_hsm Hierarchical State Machines - ::QHsm class - QHsm_ctor() - QHSM_INIT() - QHSM_DISPATCH() - QHsm_state() - QHsm_top() @section api_qfn QF-nano (Active Object Framework) QF is a portable, event-driven, real-time framework for execution of active objects (concurrent state machines) specifically designed for real-time embedded (RTE) systems. @subsection api_qfn_act Active Objects - ::QActive class - QActive_ctor() - QACTIVE_POST() - QACTIVE_POST_X() @subsection api_qfn_time Time Events - QF_tickXISR() - QActive_armX() - QActive_disarmX() @section api_qvn QV-nano (Cooperative Kernel) QV is a simple **cooperative** kernel (previously called "Vanilla" kernel). This kernel executes active objects one at a time, with priority-based scheduling performed before processing of each event. Due to naturally short duration of event processing in state machines, the simple QV kernel is often adequate for many real-time systems. The QV scheduler is engaged after every RTC step of any @termref{active object} to choose the next active object to execute. The QV scheduler always chooses the highest-priority active object that has any events in its event queue. The QV scheduler then extracts the next event from this queue and dispatches it to the state machine associated with the active object. The state machine runs to completion, after which the QV scheduler runs and the cycle repeats. Please note that because the state machines always return to the QV scheduler after each RTC step, a single stack can be used to process all state machines (memory-friendly architecture). The QV scheduler can also very easily detect when all event queues are empty, at which point it can call the idle callback to let the application put the CPU and peripherals to a low-power sleep mode (power-friendly architecture). Given the simplicity, portability, and low-resource consumption, the QV scheduler is very attractive. It allows you to partition the problem into active objects and execute these active objects orderly. The task-level response of this scheduler is the longest RTC step in the whole system, but because event-driven active objects don’t block, the RTC steps tend to be very short (typically just a few microseconds). Also, often you can break up longer RTC steps into shorter pieces, by posting an event to self and returning (“Reminder” state pattern). The self-posted event then triggers the continuation of longer processing. @subsection api_qv_init Kernel Initialization and Control - QV_INIT() - QF_run() - QV_onIdle() - QV_CPU_SLEEP() @section api_qkn QK-nano (Preemptive Run-to-Completion Kernel) QK is a tiny **preemptive**, priority-based, non-blocking kernel designed specifically for executing active objects. QK runs active objects in the same way as prioritized interrupt controller (such as NVIC in ARM Cortex-M) runs interrupts using the single stack. Active objects process their events in run-to-completion (RTC) fashion and remove themselves from the call stack, the same way as nested interrupts remove themselves from the stack upon completion. At the same time high-priority active objects can preempt lower-priority active objects, just like interrupts can preempt each other under a prioritized interrupt controller. QK meets all the requirement of the Rate Monotonic Scheduling (a.k.a. Rate Monotonic Analysis RMA) and can be used in hard real-time systems. @subsection api_qkn_ctrl Kernel Initialization and Control - QK_INIT() - QF_run() - QK_onIdle() - QK_schedLock() - QK_schedUnlock() @subsection api_qkn_isr Interrupt Management - QK_ISR_ENTRY() - QK_ISR_EXIT() */ ================================================ FILE: doxygen/exa.dox ================================================ /*! @page exa Examples @tableofcontents @section exa_gen General Comments The QP-nano distribution contains many @subpage exa_ref "example projects" to demonstrate various QP-nano features. Each example project is described on its own dedicated page that you can find using several criteria (see @ref exa_ref). The example projects have the following main goals: - **to help you learn how to use QP-nano** — the examples show the intended way of using QP-nano features and structuring QP-nano applications. - **to provide you with a starting point for your own projects** — the examples are complete working projects, with correctly pre-configured tools, such as compiler options, linker script, debugger setup, etc. @note It is highly recommended that you create your own projects by **copying and modifying** existing example projects rather than starting your QP-nano projects from scratch. @subsection exa_code Example Code Structure Starting with QP-nano release 5.4.0, **all** examples are bundled into the QP-nano download, as opposed to being distributed as separate QP Development Kits (QDKs). The main benefit is of this approach is that it greatly reduces chances of mistakes in combining the mainline QP-nano code with various QDKs. The downside is that the QP-nano distribution becomes quite large and that examples can't be added or updated independently from the QP-nano baseline code. All examples are located in sub-directories of the examples @ref qpn_files "top-level folder", with the hierarchical organization outlined below:
  • examples
    • arm-cm — Native examples for ARM-Cortex-M (bare-metal) [A]
      • blinky_ek-tm4c123gxl — Blinky example for EK-TM4C123GXL board
        • qk — Version for the @ref comp_qk "preemptive QK kernel"
          • arm — build with ARM toolset
            • dbg — Debug @ref exa_sec_conf "build configuration"
            • rel — Release build configuration
          • gnu — build with GNU toolset
          • iar — build with IAR toolset
        • qv — Version for the @ref comp_qv "cooperative QV kernel"
          • arm — build with ARM toolset
            • dbg — Debug @ref exa_sec_conf "build configuration"
            • rel — Release build configuration
          • gnu — build with GNU toolset
          • iar — build with IAR toolset
        • ... — source code independent on the toolset
    • workstation — Examples for Workstations [B]
      • blinky — Blinky example for workstations (console app)
      • dpp — DPP example for workstations (console app)
      • . . . — Other examples for workstations (console app)
  • A @subpage exa_native "Native examples" are located in sub-directories named after the CPU architecture, such as arm-cm for ARM Cortex-M. Under that directory, the sub-directories blinky_ek-tm4c123gxl contain the specific example on the specified board, such as "Blinky" on the EK-TM4C123GXL board here. In the specific example folder, you find sub-folders for the @ref comp_qk "QK" and @ref comp_qv "QV" kernels, respectively.
  • B @subpage exa_os "Examples for Workstations" are located in sub-directory workstation. These examples can be built on Windows, Linux and MacOS.
@note Because the QP-nano distribution contains *all* examples, the number of sub-directories and files in the examples folder may seem daunting. However, knowing the structure of the examples folder, you can simply **delete** the sub-directories that are not interesting to you. @subsection exa_sec_apps Example Applications To demonstrate QP-nano features on an embedded board, you need to create an application that does "something interesting". Instead of inventing this "something interesting" for each and every example, the example projects implement one of the three @subpage exa_apps "example applications", which are described on the separate pages: - @ref blinky - @ref dpp - @ref pelican - @ref game With the exception of the game application, all other example applications can be implemented on a board with just a couple of LEDs. The @ref game application is a bit more involved and requires a small graphic display on the board. Beyond these basic applications for demonstrating and testing the various @ref ports "QP-nano ports", the QP-nano distribution contains all examples described in the book Practical UML Statecharts in C/C++, 2nd Edition @sa @ref exa_os @subsection exa_sec_boards Development Boards While some provided examples can run on your @ref exa_os "desktop computer", most embedded example projects require special hardware in form of @ref exa_sec_boards, which you need to acquire to be able to run the examples. The boards chosen for the examples are generally inexpensive and self-contained with no need for external hardware (such as external JTAG debuggers or power supplies). @subsection exa_sec_tools Development Tools Most provided examples require special embedded cross-development tools, such as embedded compilers, linkers, debuggers and IDEs, which you need to acquire independently from the QP-nano distribution. Generally, the examples work with the free (size limited) evaluation versions of the commercial tools. The examples list the versions of tools they were developed and tested with. Please refer to the @ref exa_ref "cross-reference section" @ref exa_sec_tools to see which embedded toolsets are used. @subsection exa_sec_conf Build Configurations QP examples @ref ports "QP ports" are provided in the following three **build configurations**: - **Debug** — this configuration is built with full debugging information and minimal optimization. When the QP framework finds no events to process, the framework busy-idles until there are new events to process. - **Release** — this configuration is built with no debugging information and high optimization. Single-stepping and debugging at the source-code level is effectively impossible due to the lack of debugging information and optimized code, but the debugger can be used to download and start the executable. When the QP framework finds no events to process, the framework puts the CPU to sleep until there are new events to process. @remark Why do you need multiple build configurations?@n The different phases of embedded software life cycle pose different challenges. During the development and maintenance phase, for example, the emphasis is on the ease of debugging and verifying the correctness of the code, which require lower levels of optimization and special scaffolding code. In contrast, for releasing the code in the final product, the emphasis is on small memory footprint and CPU time efficiency, which require high-level of optimization and removal of any scaffolding code. To address these conflicting needs, the same source code is compiled into multiple **build configurations** that differ in the use of compiler options and activation of the scaffolding code. @subsection exa_sec_qm QM Models Many example projects contain code auto-generated by the QM modeling tool. Such projects always contain the corresponding **QM model** file, which you can open in QM, modify, and re-generate the code. @note The auto-generated files are saved as **read-only**. This protects them from inadvertent modifications, which will get lost when the files are re-generated by QM (or QMC). All modifications to the auto-generated code should be done in the QM model, not in the code. @subsection exa_sec_3rd Third-Party Code The QP-nano example projects often need to use various additional code, such as MCU register definition files, startup code, device drivers, etc., which are provided by Third-Party vendors. All such code is located in the 3rd_party @ref qpn_files "top-level folder". @note As far as possible, the code in the 3rd_party folder has been left unchanged from the original source. (Any modified code is clearly identified by top-level comments that detail the applied changes.) For that reason, the Third-Party code might produce **compilation warnings** in your builds. The code in the 3rd_party folder comes from various sources, and Quantum Leaps, LLC expressly makes **no claims of ownership** to any of this code, even though some of the code might be customized or modified by Quantum Leaps. @attention The Third-Party software components included in the 3rd_party folder are licensed under a variety of different licensing terms that are defined by the respective owners of this software and are spelled out in the `README.txt` or `LICENSE.txt` files included in the respective sub-folders. @section exa_own Creating your Own QP-nano Projects Perhaps the most important fact of life to remember is that in embedded systems nothing works until everything works. This means that you should always start with a working system and gradually evolve it, changing one thing at a time and making sure that it keeps working every step of the way. Keeping this in mind, the provided QP-nano application examples, such as the super-simple Blinky, or a bit more advanced @ref dpp or @ref game, allow you to get started with a working project rather than starting from scratch. You should also always try one of the provided example projects on the same evaluation board that it was designed for, before making any changes. Only after convincing yourself that the example project works "as is", you can think about creating your own projects. At this point, the easiest and recommended way is to copy the existing working example project folder (such as the Blinky example) and rename it. After copying the project folder, you still need to change the name of the project/workspace. The easiest and safest way to do this is to open the project/workspace in the corresponding IDE and use the Save As... option to save the project under a different name. You can do this also with the QM model file, which you can open in QM and "Save As" a different model. @note By copying and re-naming an existing, working project, as opposed to creating a new one from scratch, you inherit the correct compiler and linker options an other project settings, which will help you get started much faster. @section exa_doc Next Steps and Further Reading About QP and QM To work with QP-nano effectively, you need to learn a bit more about active objects and state machines. Below is a list of links to enable you to further your knowledge: 1. The book “Practical UML Statecharts in C/C++, 2nd Edition” [PSiCC2] and the companion web-page to the book (https://www.state-machine.com/psicc2/ 2. Free Support Forum for QP/QM (https://sourceforge.net/p/qpc/discussion/668726 ) 3. QP Code Downloads summary (https://www.state-machine.com/downloads ) 4. QP Application Notes (https://www.state-machine.com/doc/an ) 5. "State Space" Blog (http://embeddedgurus.com/state-space/ ) @next{exa_ref} */ /*##########################################################################*/ /*! @page exa_ref Cross-Reference @tableofcontents @section exa_ref_native Native Examples (by Built-in Kernel) - @ref exa_qv - @ref exa_qk @section exa_ref_native Native Examples (by Processor) - @ref exa_arm-cm (Cortex-M0/M0+/M3/M4/M4F) - @ref exa_arm7-9 ("classic ARM") - @ref exa_msp430 ("classic" MSP430 and "extended" MSP430x) - @ref exa_avr (8-bit megaAVR) @section exa_ref_os Examples for Third-Party OS - @subpage exa_os @section exa_ref_boards Examples by Development Board The boards chosen for the examples are generally inexpensive and self-contained with minimal need for external hardware (such as external JTAG debuggers or power supplies). Also, all the selected boards provide a virtual COM port (ideally). @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - ARM Cortex-M Boards: - EK-TM4C123GXL (TivaC LaunchPad) - EFM32-SLSTK3401A - mbed-LPC1768 - NUCLEO-L053R8 - NUCLEO-L152RE - EK-LM3S6965 - STM32F4-Discovery - ARM7 Boards: - AT91SAM7S-EK - MSP430 Boards: - MSP-EXP430G2 (MSP430 LaunchPad) - MSP-EXP430F5529LP (MSP430X LaunchPad) - AVR (megaAVR) Boards: - Arduino-UNO @section exa_ref_mcu Native Examples by MCU Architecture - ARM Cortex-M0/M0+ - @ref arm-cm_dpp_nucleo-l053r8 - ARM Cortex-M3 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_dpp_mbed-lpc1768 - ARM Cortex-M4F (with hardware FPU) - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_game_efm32-slstk3401a - ARM7 / ARM9 - @ref arm7-9_dpp_at91sam7s-ek - MSP430 - @ref msp430_blinky_msp-exp430g2 - @ref msp430_blinky_msp-exp430f5529lp - @ref msp430_dpp_msp-exp430g2 - AVRmega - @ref avr_blinky_arduino-uno - @ref avr_dpp_arduino-uno - PIC24 /dsPIC (coming soon...) - PIC32 (coming soon...) - Renesas RX (coming soon...) - TI TMS320C28x (C28x) (coming soon...) - TI TMS320C55x (C55x) (coming soon...) @section exa_ref_tool Native Examples by Development Toolchain @n @subsection exa_ref_arm-clang ARM-Clang Toolchain (ARM Compiler 6) - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_ek-tm4c123gxl @subsection exa_ref_arm-keil ARM-Keil Toolchain (ARM Compiler 5) - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_game_efm32-slstk3401a @subsection exa_ref_gnu-arm GNU-ARM (command-line with Makefile, importable to Eclipse) - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_mbed-lpc1768 - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_game_efm32-slstk3401a - @ref arm7-9_dpp_at91sam7s-ek @subsection exa_ref_gnu-ccs GNU-ARM with TI CCS IDE - @ref arm-cm_dpp_ek-tm4c123gxl @subsection exa_ref_iar-arm IAR EWARM - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_mbed-lpc1768 - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_game_efm32-slstk3401a - @ref arm7-9_dpp_at91sam7s-ek @subsection exa_ref_ti-arm TI ARM with CCS IDE - @ref arm-cm_dpp_ek-tm4c123gxl @subsection exa_ref_ccs-430 CCS for MSP430 - @ref msp430_blinky_msp-exp430g2 - @ref msp430_blinky_msp-exp430f5529lp - @ref msp430_dpp_msp-exp430g2 @subsection exa_ref_iar-430 IAR EW430 - @ref msp430_blinky_msp-exp430g2 - @ref msp430_blinky_msp-exp430f5529lp - @ref msp430_dpp_msp-exp430g2 @subsection exa_ref_iar-avr GNU-AVR - @ref avr_blinky_arduino-uno - @ref avr_dpp_arduino-uno @subsection exa_ref_iar-avr IAR-AVR - @ref avr_blinky_arduino-uno - @ref avr_dpp_arduino-uno @section exa_ref_vendor Examples by MCU Vendor - Atmel - @ref arm7-9_dpp_at91sam7s-ek - @ref avr_blinky_arduino-uno - @ref avr_dpp_arduino-uno - NXP - @ref arm-cm_dpp_mbed-lpc1768 - Silicon Labs - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_game_efm32-slstk3401a - STMicroelectronics - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - Texas Instruments - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_game_efm32-slstk3401a @next{exa_native} */ ================================================ FILE: doxygen/exa_apps.dox ================================================ /*##########################################################################*/ /*! @page exa_apps Example Applications

To demonstrate QP-nano features, you need to create an application that does "something interesting". Instead of inventing this "something interesting" for each and every example, most of the example projects implement one of the three example applications, which are described on the separate pages:

- @subpage blinky - @subpage pelican - @subpage dpp - @subpage game Additionally, the QP-nano distribution contains several application examples described in the PSiCC2 book. - Calculator - QHsmTst - PELICAN - ... */ /*##########################################################################*/ /*! @page blinky Simple Blinky Application

The ultra-simple Blinky example is the embedded systems' equivalent of the venerable "Hello World!" program, that is, the simplest possible working QP application that does "something". In the case of Blinky, this "something" is blinking an LED at the rate of 1Hz, where an LED turns on and remains on for 0.5 seconds on then turns off and remains off for 0.5 seconds.

@image html blinky_ek-tm4c123gxl.gif Blinky on EK-TM4C123GLX (TivaC LaunchPad) The ultra-simple Blinky application, which consists of just one active object named `Blinky`, is intentionally kept small and illustrates only the most basic QP features, such as: - defining a simple Blinky active object (AO) @ref oop "class"; - hand-coding the simple state machine of the Blinky AO; - using a periodic time event; - initializing the QP framework; and - starting an AO. @section blinky_sm State Machine The very simple state machine of the Blinky AO is shown in the figure below: @image html SM_blinky.png "State Machine of the Blinky AO"
  • 1 The top-most initial transition in this state machine arms a QP time event (QTimeEvt_armX()) to deliver the `TIMEOUT` signal every half second, so that the LED can stay on for one half second and off for the other half.
  • 2 The initial transition leads to state "off", which turns the LED off in the entry action (`BSP_ledOff()`).
  • 3 When the `TIMEOUT` event arrives in the "off" state, the "off" state transitions to the "on" state
  • 4 The "on" state turns the LED on in the entry action (`BSP_ledOn()`).
  • 5 When the `TIMEOUT` event arrives in the "on" state, the "on" state transitions back to "off", which cases execution of the entry action, in which the LED is turned off. From that point on the cycle repeats forever because the `TIMEOUT` events keep getting generated at the pre-determined rate.
@section blinky_code State Machine Code The Blinky state machine shown above is implemented in the blinky.c source file, as shown in the listing below. The code has been specifically organized not to access target resources directly, but instead encapsulate all such access in the calls to the BSP (Board Support Package). So for example, instead of turning the LED on and off by writing to a specific GPIO register on an embedded board, the code calls the BSP functions `BSP_ledOn()` and `BSP_ledOff()`. These functions can then be defined differently for each Target board (or even a desktop workstation), without the need to change the state machine code. @note The Blinky source code (blinky.c) is actually the same on all platforms, including Windows and the embedded boards. The only difference is in the Board Support Package (bsp.c), which is specific for the target. @includelineno examples/arm-cm/blinky_ek-tm4c123gxl/blinky.c As you can see, the structure of the state machine is very clearly recognizable in this code. Please refer to the Application Note A Crash Course in UML State Machines for exact explanation of the state machine coding techniques. @subsection blinky_ao Defining Active Object (AO) Class - hand-coding the simple state machine of the Blinky AO; - using a periodic time event; - initializing the QP framework; and - starting an AO. @next{dpp} */ /*##########################################################################*/ /*! @page pelican PEdestrian LIght CONtrolled (PELICAN) Crossing @image html under_construction.jpg @next{game} */ /*##########################################################################*/ /*! @page dpp Dining Philosophers Problem (DPP) @image html dpp_win32.jpg @image html under_construction.jpg @next{game} */ /*##########################################################################*/ /*! @page game "Fly 'n' Shoot" Game @image html game_win32.jpg @image html under_construction.jpg */ ================================================ FILE: doxygen/exa_native.dox ================================================ /*##########################################################################*/ /*! @page exa_native Native Examples (Built-in Kernels)

The QP-nano framework contains real-time kernels (@ref comp_qv and @ref comp_qk), so it can run natively ("bare-metal") on single-chip microcontrollers, completely replacing a traditional RTOS. Click on the following links to see examples for the specified built-in kernels:

- @subpage exa_qv - @subpage exa_qk Click on the following links to see examples for the specified CPU architectures: - @subpage exa_arm-cm - @subpage exa_arm7-9 - @subpage exa_msp430 - @subpage exa_avr */ /*##########################################################################*/ /*! @page exa_qv QV-nano Kernel (Non-Preemptive, Priority-Based, Non-Blocking) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_game_efm32-slstk3401a - @ref arm7-9_dpp_at91sam7s-ek - @ref msp430_blinky_msp-exp430g2 - @ref msp430_blinky_msp-exp430f5529lp - @ref msp430_dpp_msp-exp430g2 */ /*##########################################################################*/ /*! @page exa_qk QK-nano Kernel (Preemptive, Priority-Based, Non-Blocking) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - @ref arm-cm_blinky_ek-tm4c123gxl - @ref arm-cm_blinky_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_nucleo-l053r8 - @ref arm-cm_dpp_nucleo-l152re - @ref arm-cm_game_efm32-slstk3401a - @ref arm7-9_dpp_at91sam7s-ek - @ref msp430_blinky_msp-exp430g2 - @ref msp430_blinky_msp-exp430f5529lp - @ref msp430_dpp_msp-exp430g2 */ /*##########################################################################*/ /*! @page exa_arm-cm ARM Cortex-M (Cortex-M0/M0+/M3/M4F) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - @subpage arm-cm_blinky_ek-tm4c123gxl - @subpage arm-cm_blinky_efm32-slstk3401a - @subpage arm-cm_dpp_ek-tm4c123gxl - @subpage arm-cm_dpp_efm32-slstk3401a - @subpage arm-cm_dpp_mbed-lpc1768 - @subpage arm-cm_dpp_nucleo-l053r8 - @subpage arm-cm_dpp_nucleo-l152re - @subpage arm-cm_game_efm32-slstk3401a */ /*##########################################################################*/ /*! @page exa_arm7-9 ARM7/ARM9 ("classic" ARM) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - @subpage arm7-9_dpp_at91sam7s-ek */ /*##########################################################################*/ /*! @page exa_msp430 MSP430 ("classic" MSP430 and "extended" MSP430x) @note You can hover the mouse cursor over the    icon in the list below to see the picture of the board. - @subpage msp430_blinky_msp-exp430g2 - @subpage msp430_blinky_msp-exp430f5529lp - @subpage msp430_dpp_msp-exp430g2 */ /*##########################################################################*/ /*! @page arm-cm_blinky_ek-tm4c123gxl Blinky on EK-TM4C123GXL @tableofcontents

This example implements the @ref blinky "Blinky sample application" on the EK-TM4C123GLX board (ARM Cortex-M4F).

@image html bd_EK-TM4C123GXL.jpg EK-TM4C123GXL board The Blinky example is located in the directory qpc/examples/arm-cm/blinky_ek-tm4c123gxl, which is organized as follows: @code{.x} qpn/ - QP-nano installation directory +-examples/ - QP-nano examples directory (application) | +-arm-cm/ - QP-nano examples for ARM Cortex-M | | +-blinky_ek-tm4c123gxl/ - Blinky example on the EK-TM4C123GLX board | | | +-qk/ - QK version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-blinky-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QK-nano kernel | | | +-qv/ - QV version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-blinky-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project with GNU-ARM | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QV-nano kernel | | | +-win32-qv/ - Windows emulation (single thread) | | | | +-Makefile - Makefile for building the project with MinGW | | | | +-bsp.c - BSP for the Win32-QV @endcode @section arm-cm_blinky_ek-tm4c123gxl_feat Features Demonstrated - cooperative QV-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - preemptive run-to-completion QK-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - Windows emulation (console, single threaded: win32-qv) @section arm-cm_blinky_ek-tm4c123gxl_run Running the Example Once programmed into the board, the example blinks the on-board LED about once a second. @image html blinky_ek-tm4c123gxl.gif Blinky on EK-TM4C123GLX (TivaC LaunchPad) @section arm-cm_blinky_ek-tm4c123gxl_win Windows Emulation The Windows emulation is a simple console application that produces the following output: @image html blinky_win32.png Blinky emulation running in a Windows console @next{arm-cm_blinky_efm32-slstk3401a} */ /*##########################################################################*/ /*! @page arm-cm_blinky_efm32-slstk3401a Blinky on EFM32-SLSTK3401A @tableofcontents

This example implements the @ref blinky "Blinky sample application" on the EFM32-SLSTK3401A board (ARM Cortex-M4F).

@image html bd_EFM32-SLSTK3401A.jpg EFM32-SLSTK3401A board The Blinky example is located in the directory qpc/examples/arm-cm/blinky_efm32-slstk3401a, which is organized as follows: @code{.x} qpn/ - QP-nano installation directory +-examples/ - QP-nano examples directory (application) | +-arm-cm/ - QP-nano examples for ARM Cortex-M | | +-blinky_efm32-slstk3401a/ - Blinky example on the EFM32-SLSTK3401A board | | | +-qk/ - QK version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-blinky-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QK-nano kernel | | | +-qv/ - QV version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-blinky-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project with GNU-ARM | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QV-nano kernel | | | +-workstation/ - Examples for workstations (Windows, Linux, MacOS) | | | | +-Makefile - Makefile for building the project with MinGW | | | | +-bsp.c - BSP for workstations @endcode @section arm-cm_blinky_efm32-slstk3401a_feat Features Demonstrated - cooperative QV-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - preemptive run-to-completion QK-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - Windows emulation (console, single threaded: win32-qv) @section arm-cm_blinky_efm32-slstk3401a_run Running the Example Once programmed into the board, the example blinks the on-board LED about once a second. @section arm-cm_blinky_efm32-slstk3401a_win Windows Emulation The Windows emulation is a simple console application that produces the following output: @image html blinky_win32.png Blinky emulation running in a Windows console @next{arm-cm_dpp_ek-tm4c123gxl} */ /*##########################################################################*/ /*! @page arm-cm_dpp_ek-tm4c123gxl DPP on EK-TM4C123GXL @tableofcontents

This example implements the @ref dpp "Dining Philosophers Problem" sample application on the EK-TM4C123GLX board (ARM Cortex-M4F).

@image html bd_EK-TM4C123GXL.jpg EK-TM4C123GXL board The DPP example is located in the directory qpc/examples/arm-cm/dpp_ek-tm4c123gxl, which is organized as follows: @code{.x} qpn/ - QP-nano installation directory +-examples/ - QP-nano examples directory (applications) | +-arm-cm/ - QP-nano examples for ARM Cortex-M | | +-dpp_ek-tm4c123gxl/ - DPP example on the EK-TM4C123GLX board | | | +-lint/ - PC-Lint version (static analysis of the application code) | | | | +-lin.bat - batch file for running the PC-Lint | | | | +-options.lnt - PC-Lint options file for the DPP application code | | | +-qk/ - QK version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-dpp-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project | | | | +-iar/ - IAR-ARM toolchain | | | | | +-dpp-qk.eww - IAR EW-ARM workspace | | | | +-ti/ - TI-ARM toolchain (CCS) | | | | | +-.ccsproject - CCS project | | | | | +-.cproject - C Eclipse project | | | | | +-.project - Eclipse project | | | | +-bsp.c - BSP for the QK-nano kernel | | | | +-main.c - main() for the QK-nano kernel | | | +-qv/ - QV version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-dpp-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project with GNU-ARM | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QV-nano kernel | | | | +-main.c - main() for the QV-nano kernel @endcode @section arm-cm_dpp_ek-tm4c123gxl_feat Features Demonstrated - cooperative QV-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain + with TI-ARM toolchain (CCS) - preemptive run-to-completion QK-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain + with TI-ARM toolchain (CCS) - Windows emulation with GUI (single threaded, win32-qv) @section arm-cm_dpp_ek-tm4c123gxl_run Running the Example Once programmed into the board, the example rapidly toggles the Blue LED from the idle loop (blue LED glows) and toggles the Red and Green LEDs as the Philosophers change their state. Additionally, you can depress and hold the SW1 button (left) to PAUSE the application (Table transitions into the "paused" state). Releasing the SW1 button causes transition back to the "serving" state. */ /*##########################################################################*/ /*! @page arm-cm_dpp_efm32-slstk3401a DPP on EFM32-SLSTK3401A @tableofcontents

This example implements the @ref dpp "Dining Philosophers Problem" sample application on the EFM32-SLSTK3401A board (ARM Cortex-M4F).

@image html bd_EFM32-SLSTK3401A.jpg EFM32-SLSTK3401A board The DPP example is located in the directory qpc/examples/arm-cm/dpp_efm32-slstk3401a and includes versions for @ref qv "cooperative QV-nano kernel", the @ref qk "preemptive QK-nano kernel", and the @ref qxk "preemptive dual mode QXK RTOS kernel" each provided for the ARM-KEIL, GNU-ARM, and IAR-ARM. The following annotated directory listing describes the contents of the example folder: @code{.x} qpn/ - QP-nano installation directory +-examples/ - QP-nano examples directory (application) | +-arm-cm/ - QP-nano examples for ARM Cortex-M | | +-dpp_efm32-slstk3401a/ - DPP example on the EK-TM4C123GLX board | | | +-lint/ - PC-Lint version (static analysis of the application code) | | | | +-lin.bat - batch file for running the PC-Lint | | | | +-options.lnt - PC-Lint options file for the DPP application code | | | +-qk/ - QK version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-dpp-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project | | | | +-iar/ - IAR-ARM toolchain | | | | | +-dpp-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QK-nano kernel | | | | +-main.c - main() for the QK-nano kernel | | | +-qv/ - QV version | | | | +-arm/ - ARM-KEIL toolchain | | | | | +-dpp-qk.uvprojx - uVision project | | | | +-gnu/ - GNU-ARM toolchain | | | | | +-Makefile - Makefile for building the project with GNU-ARM | | | | +-iar/ - IAR-ARM toolchain | | | | | +-blinky-qk.eww - IAR EW-ARM workspace | | | | +-bsp.c - BSP for the QV-nano kernel | | | | +-main.c - main() for the QV-nano kernel @endcode @section arm-cm_dpp_efm32-slstk3401a_feat Features Demonstrated - cooperative QV-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - preemptive run-to-completion QK-nano kernel + with ARM-KEIL toolchain + with GNU-ARM toolchain + with IAR-ARM toolchain - Windows emulation with GUI (single threaded, win32-qv) @section arm-cm_dpp_efm32-slstk3401a_run Running the Example Once programmed into the board, the example rapidly toggles the LED1 from the idle loop (LED1 glows) and toggles LED0 as the Philosophers change their state. Additionally, you can depress and hold the BTN0 button (left) to PAUSE the application (Table transitions into the "paused" state). Releasing the BTN0 button causes transition back to the "serving" state. */ /*##########################################################################*/ /*! @page arm-cm_dpp_mbed-lpc1768 DPP on mbed-LPC1768 @image html bd_mbed-LPC1768.jpg mbed-LPC1768 board Dining Philosophers Problem (DPP) example for NXP LPC1768 MCU (Cortex-M3) with GNU-ARM toolchain. @image html mbed-LPC1768_button.jpg Adding External Button to mbed-LPC1768 @n @n @image html under_construction.jpg */ /*##########################################################################*/ /*! @page arm-cm_dpp_nucleo-l053r8 DPP on NUCLEO-L053R8 @image html bd_nucleo-l053r8.jpg NUCLEO-L053R8 board @ref dpp "Dining Philosophers Problem (DPP)" example for NUCLEO-L053R8 MCU (Cortex-M0+). Demonstrated built-in kernels: - cooperative @ref qv with ARM-Clang, ARM-Keil, GNU-ARM (Makefile and Atollic TRUEstudio), and IAR-ARM toolchains - preemptive, run-to-completion @ref qk with ARM-Clang, ARM-Keil, GNU-ARM, and IAR-ARM toolchains Features: - multiple active objects, including 5 instances of the same AO class (Philo) - QK_onContextSw() callback function */ /*##########################################################################*/ /*! @page arm-cm_dpp_nucleo-l152re DPP on NUCLEO-L152RE @image html bd_nucleo-l152re.jpg NUCLEO-L152RE board @ref dpp "Dining Philosophers Problem (DPP)" example for NUCLEO-L152RE MCU (Cortex-M3). Demonstrated built-in kernels: - cooperative @ref qv with ARM-Clang, ARM-Keil, GNU-ARM, and IAR-ARM toolchains - preemptive, run-to-completion @ref qk with ARM-Clang, ARM-Keil, GNU-ARM, and IAR-ARM toolchains Features: - multiple active objects, including 5 instances of the same AO class (Philo) */ /*##########################################################################*/ /*! @page arm-cm_game_efm32-slstk3401a "Fly 'n' Shoot" Game on EFM32-SLSTK3401A @image html bd_EFM32-SLSTK3401A.jpg EFM32-SLSTK3401A board "Fly 'n' Shoot" game example for Silicon Labs Pearl Gecko MCU (Cortex-M4F), ARM (MDK-ARM), GNU-ARM, IAR EWARM toolsets. @image html game_win32.png Game emulation running in Windows GUI @n @n @image html under_construction.jpg */ /*##########################################################################*/ /*! @page exa_arm7-9 ARM7 / ARM9 The native (bare-metal) QP-nano examples for the "classic" ARM7/ARM9 are as follows: - @subpage arm7-9_dpp_at91sam7s-ek */ /*##########################################################################*/ /*! @page arm7-9_dpp_at91sam7s-ek DPP on AT91SAM7S-EK @image html bd_AT91SAM7S-EK.jpg AT91SAM7S-EK board Dining Philosophers Problem (DPP) example for Atmel AT91SAM7S MCU (ARM7) with GNU-ARM toolset. @image html under_construction.jpg */ /*##########################################################################*/ /*! @page exa_avr AVR (AVRmega) The native (bare-metal) QP-nano examples for the 8-bit AVRmega are as follows: - @subpage avr_blinky_arduino-uno - @subpage avr_dpp_arduino-uno */ /*##########################################################################*/ /*! @page avr_blinky_arduino-uno Blinky on Arduino-UNO @image html bd_Arduino-UNO.jpg Arduino-UNO board Simple Blinky example for Arduino-UNO with GNU-AVR and IAR-AVR toolsets. @image html under_construction.jpg */ /*##########################################################################*/ /*! @page avr_dpp_arduino-uno DPP on Arduino-UNO @image html bd_Arduino-UNO.jpg Arduino-UNO board Dining Philosophers Problem (DPP) example for Arduino-UNO with GNU-AVR and IAR-AVR toolsets. @image html Arduino-UNO_button.jpg Adding External Button to Arduino-UNO @n @n @image html Arduino-UNO_button_schem.jpg External Button Schematics @n @n @image html under_construction.jpg */ /*##########################################################################*/ /*! @page exa_msp430 MSP430 The native (bare-metal) QP-nano examples for MSP430 are as follows: - @subpage msp430_blinky_msp-exp430g2 - @subpage msp430_blinky_msp-exp430f5529lp - @subpage msp430_dpp_msp-exp430g2 */ /*##########################################################################*/ /*! @page msp430_blinky_msp-exp430g2 Blinky on MSP-EXP430G2 @image html bd_MSP-EXP430G2.jpg MSP-EXP430G2 board Simple Blinky example for MSP-EXP430G2 with CCS-430 and IAR-430 toolsets. @image html under_construction.jpg */ /*##########################################################################*/ /*! @page msp430_blinky_msp-exp430f5529lp Blinky on MSP-EXP430F5529LP @image html bd_MSP-EXP430F5529LP.jpg MSP-EXP430F5529LP board Simple Blinky example for MSP-EXP430F5529LP with CCS-430 and IAR-430 toolsets. @image html under_construction.jpg */ /*##########################################################################*/ /*! @page msp430_dpp_msp-exp430g2 DPP on MSP-EXP430G2 @image html bd_MSP-EXP430G2.jpg MSP-EXP430G2 board DPP example for MSP-EXP430G2 with CCS-430 and IAR-430 toolsets. @image html under_construction.jpg */ ================================================ FILE: doxygen/exa_os.dox ================================================ /*##########################################################################*/ /*! @page exa_os Examples for Workstations (Windows/POSIX)

The examples/workstation folder contains all examples described in the book Practical UML Statecharts in C/C++, 2nd Edition and more. These examples include:

- blinky Simple "Blinky" for Windows (command line) - calc Calculator example from Chapter 2 of PSiCC2 - comp Orthogonal Component design pattern - comp_qm Orthogonal Component with QM model design pattern - defer Deferred Event design pattern - dpp DPP (command-line) - dpp-comp DPP with the "Orthogonal Component" pattern (command-line) - dpp-gui DPP (with GUI on Windows) - game-gui "Fly 'n' Shoot" game from Chapter 1 of PSiCC2 - history Transition-to-History design pattern (hand-coded) - pelican PEdestrian LIgth CONtrolled Crossing (command line) - qhsmtst Test State Machine based on ::QHsm with QM model - reminder Reminder design pattern from Chapter 5 of PSiCC2 - reminder2 Reminder design pattern different version @sa @ref win32-qv "QP-nano Win32-QV Emulation" */ ================================================ FILE: doxygen/gs.dox ================================================ /*! @page gs Getting Started @section gs_obtain Downloading & Installing QP-nano™ @tableofcontents

The most recommended way of obtaining QP-nano™ is by downloading the QP-bundle™, which includes QP-nano™ as well as other QP frameworks and also the QM™ modeling tool and the QTools™ collection. The main advantage of obtaining QP-nano™ bundled together like that is that you get all components, tools and examples ready to go. @note QP-bundle™ is the **most recommended** way of downloading and installing QP-nano™. However, if you are allergic to installers and GUIs or don't have administrator privileges you can also **download and install QP-nano™ separately** as described in the Application Note: "Getting Started with QP-nano" below. @section gs_an Getting Started with QP-nano App Note The Quantum Leaps Application Note Getting Started with QP-nano provides step-by-step instructions on how to get started with QP-nano quickly. @htmlonly

Application Note: Getting Started with QP-nano
@endhtmlonly @section gs_files Directories and Files The following annotated directory tree lists the top-level directories provided in the standard QP-nano distribution.
  • qpn
    • 3rd_party — Third-Party code used in the QP-nano @ref ports "ports" and @ref exa "examples"
    • examples — @ref exa "QP-nano Examples"
    • ports — @ref ports "QP-nano Ports"
    • include — Platform-independent QP-nano API (see include)
    • source — Platform-independent QP-nano source code (see @ref source)
@note The standard QP-nano distribution contains many @ref exa "Example Projects", which are specifically designed to help you learn to use QP-nano and to serve you as starting points for your own projects. @next{struct} */ ================================================ FILE: doxygen/history.dox ================================================ /** @page history Revision History @section qpn_6_9_0 Version 6.9.0, 2020-08-21 - Applied the Doxygen commands `extends` and `memberof` to indicate inheritance and to explicitly specify base classes for all derived classes (e.g., QActive extends QHsm). - Fixed some errors in documentation comments in source code, etc. - Bumped version to 6.9.0 for compatibility with QM 5.1.3 @attention This is the last QP-nano release. The QP-nano framework is being __phased out__ and is not recommended for new product development. @section qpn_6_8_2 Version 6.8.2, 2020-06-30 - Updated 3rd_party/CMSIS to version 5.7.0 - Updated example projects for ARM Cortex-M with ARM/KEIL to use the startup in the odler ARM assembly (as opposed to ARMCLANG assembly) - Updated the doxygen styling @section qpn_6_8_1 Version 6.8.1, 2020-04-04 Fixedhe following bugs: This release updates the QP-nano ports and examples for workstations (Windows and POSIX) by consistently applying the "safe" versions of services from `` and ``. The "portable" versions of these services are defined as macros in the `safe_std.h` header file and include the following services: - `MEMMOVE_S()` -> `memmove_s()` - `STRCPY_S()` -> `strcpy_s()` - `STRCPY_S()` -> `strcpy_s()` - `STRCAT_S()` -> `strcat_s()` - `SNPRINTF_S()` -> `_snprintf_s()` - `PRINTF_S()` -> `printf_s()` - `FPRINTF_S()` ->`fprintf_s()` - `FREAD_S()` -> `fread_s()` - `FOPEN_S()` -> `fopen_s()` - `LOCALTIME_S()` -> `localtime_s()` These "safe" functions are mapped to the best approximation of these services available on a given platform. For example, `STRCPY_S()` is mapped to `strcpy_s()` on Windows and `strcpy()` on POSIX (Linux/MacOS/etc.). Finally, this release consistently applies the #Q_NORETURN macro to the Q_onAssert() implementations in the QP-nano examples. @section qpn_6_8_0 Version 6.8.0, 2020-03-21 Source code changes: - Fixed inconsistencies between QP API declarations in the .h files and definitions in the .c files, such as different parameter names in declarations and definitions (MISRA-C:2012). - Removed a lot of excessive type casting of compile-time constants, such as `(uint8_t)0`, which is now coded simply as `0U` - Introduced #Q_NORETURN macro for Q_onAssert(), which can (if defined) inform the compiler that Q_onAssert() does not return. This can potentially improve the code generation and can improve diagnostics generated by the compiler as well as static code analysis tools. Updated Examples: Converted most of the examples for ARM-MDK from the no-longer maintained compiler-5 (RVDS) to the new ARM Compiler-6 (ARM-clang). The examples for ARM Compiler-6 are located in the `armclang` sub-directories. @note The older ARM Compiler-5 is still supported, but will be phased out in the future. The only examples for ARM Compiler-5 are for the EK-TM4C123GXL (TivaC LanuchPad) board. These examples are located in the `arm` sub-directories. @section qpn_6_7_0 Version 6.7.0, 2019-12-30 The main purpose of this release is providing improved compliance with MISRA-C:2012 (including MISRA-C:2012-Amendment-1) and also to provide support for the [PC-Lint-Plus](https://www.gimpel.com/) static analysis tool (see also feature request [#169](https://sourceforge.net/p/qpc/feature-requests/169/)). Specifically, the QP-nano source code and some examples have been adjusted to comply with MISRA-C:2012-Amendment-1 rules, with all deviations captured in the PC-Lint-Plus configuration files. These PC-Lint-Plus configuration files have been provided in the new "port" to PC-Lint-Plus in the directory qpn/ports/lint-plus/. @note The support for the older PC-Lint 9.x and the older MISRA-C:2004 has been dropped to avoid confusion and conflicts with the newer MISRA-C:2012 and the newer PC-Lint-Plus. This release also includes the offline documentation for **this** particular version of QP-nano (in the `html/` folder). To view the offline documentation, open the file `html/index.html` in your web browser. (The online HTML documention for the **latest** version of QP-nano remains located at: https://www.state-machine.com/qpc/ ) Also, this release drops (no longer supports) the following depricated facilities from the qpn.h header file: - Q_ROM_VAR - just remove from your code - Q_RENTRANT - just remove from your code - QMSM_INIT() - use QHSM_INIT() instead - QMSM_DISPATCH() - use QHSM_DISPATCH() instead - QF_onIdle() - use QV_onIdle() instead - QMsm_ctor() - use QHsm_ctor() instead - QMsm_init() - use QHSM_INIT() instead - QMsm_dispatch() - use QHSM_DISPATCH() instead - QMActive_ctor() - use QActive_ctor() instead - QMsm_init() - use QHSM_INIT() instead - QActive_post() - use QACTIVE_POST() instead - QActive_postISR() - use QACTIVE_POST_ISR() instead - QActive_arm() - use QActive_armX() instead - QActive_disarm() - use QActive_disarmX() instead - Q_TIMERSET - define QF_TIMEEVT_USAGE instead Also, this release updates the Windows-GUI examples with the QWIN Prototyping Toolkit to work with the latest Visual Studio 2019 and specifically with the Resource Editor now available. Specifically here, the Game-GUI example (qpn\examples\arm-cm\game_efm32-slstk3401a\win32-gui) and the DPP-GUI example (qpn\examples\arm-cm\dpp_efm32-slstk3401a\win32-gui) have been updated to build with the Visual Studio 2019. Finally, this release fixes the following bugs: - [bug#255 "IAR-ARM "Multi-file Compilation" fails for QK and QXK applications"](https://sourceforg/bugs/255/) @section qpn_6_6_0 Version 6.6.0, 2019-10-31 The main purpose of this release is the change in distribution of the QP-nano framework, which is now bundled together with the other QP frameworks (QP/C and QP/C++) as well as QM, and the QTools collection into "QP-bundle". This "QP-bundle" provides a single, streamlined and simplified download and installation of all QP frameworks and all the accompanying tools. This release brings also the following changes: - removed "//" (double slash) from all comments for compliance with the MISRA-C:2012 required Rule 3.1. (The "//" sequence was used in the URLs, such as "http://..."). - converted inclusion guards in header files to uppercase as per coding convention for macros. - replaced "vtbl" with "vtable" in QP-nano source code - extended the range of #Q_PARAM_SIZE to 8 (8 corresponding to uint64_t) - fixed [bug#252 qassert.h used as standalone in qpn](https://sourceforge.net/p/qpc/bugs/252/) @section qpn_6_5_1 Version 6.5.1, 2019-06-11 This release adds ports and examples for PIC24/dsPIC 16-bit MCUs with MPLAB-X and XC16 compiler toolchain. @section qpn_6_5_0 Version 6.5.0, 2019-03-30 This QP-nano release matches the [QM release 4.5.0](https://www.state-machine.com/qm/history.html#qm_4_5_0), which introduced new implementation for QP/C++. Even though this has no impact on the QP-nano state machine implementation with QM, this release is needed for compatibility checking between QP and QM. This release comes with several models for **QM 4.5.0**. @section qpn_6_4_0 Version 6.4.0, 2019-02-10 This release brings the following changes: - added assertion to QHSM_INIT() to make sure the the virtual-pinter (vptr) is initialized @note These additional assertions require #Q_DEFINE_THIS_FILE or #Q_DEFINE_THIS_MODULE at the top of the .c file that calls QHSM_INIT(). - modified qassert.h to work correctly when assertions are disabled with #Q_NASSERT and also updated the QP/C source code to build correctly without assertions - modified Makefiles for workstations (Windows and POSIX) to use compiler options -std=c99 for C and -std=c++11 for C++ as well as -pedantic option. @section qpn_6_3_8 Version 6.3.8, 2018-12-31 The main purpose of this release is the update the `Makefiles` that use the [GNU-ARM Embedded Toolchain](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm) to match the recent update in [QTools for Windows 6.3.8](https://sourceforge.net/projects/qpc/files/QTools/). Specifically, all `Makefiles` in the `examples` directory have been updated to use the GNU-ARM toolchain located in `qtools\gnu_arm-none-eabi` and use the tools prefix **arm-none-eabi-**. @note The `Makefiles` that use the GNU-ARM included in this release require [QTools for Windows version 6.3.8 or newer](https://sourceforge.net/projects/qpc/files/QTools/) and will **NOT** work with the older QTools collection. @section qpn_6_3_7 Version 6.3.7, 2018-12-07 The main purpose of this release is re-designing of the @ref exa_os "examples for workstations" (previously `win32-qv` and `posix-qv`). All these types of examples have been consolidated in the @ref exa_os "exampes/workstation" folder, where the provided `Makefiles` have been extended to be cross-platform so that they work on Windows, Linux, and MacOS without changes. To facilitate the creation of truly portable, cross-platform examples, the existing @ref ports_os "QP ports to Windows/POSIX" have been augmented with abstractions for portable console access. @section qpn_6_3_3 Version 6.3.3, 2018-06-22 This release fixes the following bugs: - [bugs:#218 "__flash attribute in avr port"](https://sourceforge.net/p/qpc/bugs/218/) - [bug#216 "Generated code for QP version check violates MISRA-C Rule 10.1"](https://sourceforge.net/p/qpc/bugs/216/). - [bug#217 "GNU-ARM -fstack-protector incompatible with the QP ports to GNU-ARM"](https://sourceforge.net/p/qpc/bugs/217/). - [bug#215 "QP is internally inconsistent in calling assertion macros"](https://sourceforge.net/p/qpc/bugs/215/). Also, this release demonstrates the new features of QM 4.3.0 in several example models (qpn/examples/ directory). Finally, this release updates `3rd_party/CMSIS/Include` to the latest version from GitHub. @section qpn_6_3_0 Version 6.3.0, 2018-05-10 This release improves the command-line scripts for flash programming of the supported MCUs. Specifically, the flash.bat batch files for EFM32-SLSTK3401A, EK-TM4C123GXL, and for Arudino UNO have been updated. @section qpn_6_2_0 Version 6.2.0, 2018-03-16 This release updates the QP-nano ports to win32-qv and posix-qv to allow a "tickless" mode, where the "tickerThread" is not created. This mode is set by configuring the system clock tick rate to 0 (QF_setTickRate(0)). Additionally, this revision updates the posix-qv port implementation to wait for the condition variable in a customary wile() loop. @section qpn_6_1_1 Version 6.1.1, 2018-02-18 The main purpose of this release is adding the context-switch callback to the preemptive @ref qkn "QK-nano" kernel. The QK_onContextSw() callback function provides a mechanism to perform additional custom operations when QK switches context from one thread to another. To avoid extra overhead when this functionality is not needed and for backwards-compatiblity with the existing applications, the callback is enabled only when the macro #QK_ON_CONTEXT_SW is defined. The macro can be defined either directly in command-line for the compiler, or in the QK-nano port file (qpn_port.h). Examples for the context-switch callbacks have been provided for the @ref arm-cm_dpp_nucleo-l053r8 "NUCLEO-L053R8" (Cortex-M0+) and the @ref arm-cm_dpp_ek-tm4c123gxl "EK-TM4C123GXL" (Cortex-M4F). Another purpose of this release is adding the support for the [ARM Compiler 6 (ARM-Clang)](https://developer.arm.com/products/software-development-tools/compilers/arm-compiler), which is a C/C++ toolchain for ARM processors based on the modern [Clang frontend](https://clang.llvm.org/) and the [LLVM framework](https://llvm.org/). This release adds the ARM-Clang ports and examples for all built-in kernels (QV-nano and QK-nano) for the ARM Cortex-M CPU cores. Also, this release changes the ARM Cortex-M ports for the IAR-ARM toolchain in that it replaces the assembly modules with the equivalent C implementation. All existing example projects for IAR-ARM have been updated to use the `qkn_port.c` files instead of `qkn_port.s` files. Also, this release adds new project files for the Atollic TRUEstudio for STM32. The TRUEstudio projects (Eclipse) have been added for the @ref arm-cm_dpp_nucleo-l053r8 "NUCLEO-L053R8" (Cortex-M0+) and the @ref arm-cm_dpp_nucleo-l152re "NUCLEO-L152RE" (Cortex-M3). Finally, this relese updates the CMSIS to version 5.3.0 (see `qpn/3rd_party/CMSIS` @section qpn_6_0_4 Version 6.0.4, 2018-01-10 This release replaces assembly with C implementation in the ARM-KEIL ports or the QK-nano kernel to Cortex-M to take advantage of the `__asm` functions. (NOTE: this change has impact on the existing QP-nano applications that use the ARM-KEIL toolchain and the QK kernel.) Also, this release adds an example of the Dining Philosophers Problem (DPP) re-designed with the ["Orthogonal Component" state pattern](https://www.state-machine.com/doc/Pattern_Orthogonal.pdf). The application uses only one active object (Table), while the Philos are stateful components of Table. The example is located in `qpn\examples\win32-qv\dpp_comp`. @section qpn_6_0_3 Version 6.0.3, 2017-12-12 This release replaces attributes of ::QActive class and ::QTimeEvtCtr type from type uint_fast8_t to uint8_t. For the ARM Cortex-M port, these changes reduce the memory footprint of each ::QActive instance from 40 to 26 bytes (35% improvement). Also, the ARM Cortex-M port and examples for the TI-ARM compiler have been removed. (Projects for the TI CCS can use the GNU-ARM toolchain and the existing GNU-ARM ports). @section qpn_6_0_1 Version 6.0.1, 2017-11-10 This release includes a workaround for the GNU-ARM compiler bug for the ARMv6-M architecture (Cortex-M0/M0+/M1), which can lead to generation of incorrect code for the QP-nano critical section at certain gcc optimization levels (such as -O). This bug was first discovered and filed as [bug#184](https://sourceforge.net/p/qpc/bugs/184/). The bug affected the GNU-ARM ports to both built-in kernels @ref qvn "QV-nano" and @ref qkn "QK-nano". @attention This release no longer contains the directory `qpn/source`, which was scheduled to be phased out in QP5. In QP6 the source code is found only in the `qpn/src` directory. @note This QP-nano 6.0.1 release is the minimum version required in the upcoming QM 4.1.0. @section qpn_5_9_8 Version 5.9.8, 2017-09-15 This release implements the feature request #126 "Allow non-asserting event posting for zero-margin allocations". Specifically, calling ACTIVE_POST_X() and ACTIVE_POST_X_ISR() with the margin argument of zero will no longer assert if the allocation/posting fails. The asserting version is these macros uses the special value of the @p margin argument of #QF_NO_MARGIN. Improved comments in the soruce code. Modifed ARM Cortex-M examples with the GNU-ARM toolset to be consistent with QP/C++ (support for RTTI and C++ Exception handling), as follows: - removed definitions of `_init()` and `_fini()` from the GNU-ARM startup code for all supported boards in the `3rd_party` directory - commented out the call to `__libc_init_array()` in the GNU-ARM startup code for all supported boards in the `3rd_party` directory (because it requires `_init()`) - Modified all GNU-ARM linker scripts (.ld files) to add the following symbols: @verbatim __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; @endverbatim ----------------------------------------------------------------------------- @section qpn_5_9_7 Version 5.9.7, 2017-08-18 This release phases out the QK-nano mutex and replaces it with an equivalent selective QK-nano scheduler locking up to the specified ceiling priority. Specifically, this feature has been implemented with two new operations QK_schedLock() and QK_schedUnlock(). This is done with consistency with the QK and QXK kernels in QP/C/C++. The advantage of the new implementation is also the ability of the scheduler locks to nest, which was not the case with the QK-nano mutex. All related QK-nano examples have been updated to use the selective scheduler locking instead of the mutex. The new blocking QXK mutex has been demonstrated in the following updated examples: - @ref arm-cm_dpp_efm32-slstk3401a - @ref arm-cm_dpp_ek-tm4c123gxl @attention The changes to QK-nano **break backwards-compatibly** with the existing code that relies these features. In the existing code, the mutexes should be replaced with selective scheduler locking. This release also updates CMSIS to version 5.1.0 (3rd_party/CMSIS). This release also adds the @ref api "API Reference" section to the QP-nano documentation. ----------------------------------------------------------------------------- @section qpn_5_9_6 Version 5.9.6, 2017-08-04 This release changes the organization of the QP-nano source code to make it more friendly for the Eclipse CDT, as proposed in the feature request #123 "Eclipse-friendly source directory structure for QP". Specifically, the QP-nano source code is now provided in the `qpn/src/` directory with the following structure: @verbatim qpn\ +-source\ - exitsting source directory with "flat" structure | (for backwards-compatibility) +-src\ - new source directory grouped by functionality +-qfn\ - core framework (QEP-nano + QF-nano) +-qkn\ - QK-nano kernel +-qvn\ - QV-nano kernel @endverbatim This release consistently changes all example projects (for all toolchains) to use the **src/** directory for QP-nano source code, instead of the **source/** directory. @note The original `qpn/source` directory is still provided for backwards compatibility with the existing QP-nano projects. This directory will be phased out in the future QP-nano releases. Please use the new source code structure provided in the `qpn/src` directory. Finally, this release adds protection in the IRQ priorities initialization in QK-nano/QV-nano for ARM Cortex-M3/M4/M7, so that the number of IRQs is extracted from bits 0-2 of the ICTR register (INTLINESNUM). @section qpn_5_9_5 Version 5.9.5, 2017-07-20 This release fixes the following bug: - bug#178 "GNU-ARM compiler reports "Error: unaligned opcodes..." in startup code for QP/C/C++/nano examples". The bug fix entails modifying the startup code for the GNU-ARM compiler in the `3rd_party` directory. Specifically, the proper alignment directives have been added to the inline assembly in the exception handlers. @section qpn_5_9_3 Version 5.9.3, 2017-07-03 This release fixes the following bugs: - bug#176 "Incorrect initialization of PendSV interrupt priority in QK-nano for ARM Cortex-M0/M0+" (https://sourceforge.net/p/qpc/bugs/176/) - bug#162 "QF critical sections require modification for M7 core" https://sourceforge.net/p/qpc/bugs/162/ Additionally, this release adapts the Makefiles for GNU-ARM to the new location of the GNU-ARM toolset, which is now included in the QTools Collection (v 5.9.1) for Windows. This release also upgrades CMSIS to version 5.0.2. @section qpn_5_8_2 Version 5.8.2, 2017-02-08 This release improves compatibility of assertion numbering between QP-nano and QP/C/C++. Specifically, qepn.c file now uses the same assertion-IDs as qep_hsm.c (QP/C) and qep_hsm.cpp (QP/C++). This release upgrades CMSIS to version 5.0.1. Finally, this release fixes the following bugs: - bug#152 Typo (qpc\ports\arm7-9\qk\gnu\qk_port.s:42) prevents compilation @section qpn_5_8_1 Version 5.8.1, 2016-12-16 This release is in response to a recent finding that many QP users of the ports to ARM Cortex-M3/M4 forget to explicitly set their interrupt priorities, as described in the AppNote "Setting ARM Cortex-M Interrupt Priorities in QP 5.x". Specifically, this release improves safety of QP ports to ARM Cortex-M3/M4, by initializing the interrupt priorities to a safe default in a generic, portable way. This QP port includes such a fix for QV-nano/QK-nano ports to ARM Cortex-M3/M4. Changes in detail: - modified the QV and QK source code to call QV_init() and QK_init(), respectively. - modified the ARM Cortex-M ports of QV-nano and QK-nano to initialize priorities all exceptions and IRQs to the safe value #QF_BASEPRI. @note The QV-nano ports to ARM Cortex-M now have a new **qvn_port.c** module that needs to be added to the build. - added the header file **cmsis_ccs.h** to qpc/3rd_party/CMSIS/Include directory (used in the examples for the Code Composer Studio). The file has been dropped during the upgrade to CMSIS 5.0.1, because it is not part of the standard distribution. @section qpn_5_8_0 Version 5.8.0, 2016-11-07 This release simplifies the QP-nano framework by removing the QMsm-style state machine implementation strategy introduced in version 5.0.0. Moving forward, the only supported state machine implementation strategy in QP-nano will be the QHsm-strategy and the upcoming QM 4.x will provide only the QHsm-strategy for QP-nano applications. Specifically, the QMsm base class, and QMActive base class have been removed, along with the accompanying macros. The QP-nano compatibility layer (file qpn.h) provides some of these macros for backwards- compatibility, but the underlying implementation must be, in fact, based on QHsm. All examples and QM models have been updated to use only the QHsm-style implementation strategy. The models also require the new upcoming QM 4.0.0. Additionally, this release fixes the following bugs: -bug#144 Obsolete Win32 API in qwin_gui.c Finally, this release includes the latest CMSIS-5, which now replaces the older CMSIS-4.5. @section qpn_5_7_3 Version 5.7.3, 2016-10-07 This release fixes the following bugs: - bug#140 (PendSV_Handler() exception stacked PC not halfword aligned). @section qpn_5_7_2 Version 5.7.2, 2016-09-30 This release changes the internal QK-nano implementation to match the QK kernel implementation used in QP/C and QP/C++. (e.g., QK_sched_() has been renamed to QK_activate_() and QK_schedPrio_() to QK_sched_()). These changes fall into the category of refactoring and have no impact on the API or performance. @section qpn_5_7_0 Version 5.7.0, 2016-08-31 This release release changes once more the QK-nano port to ARM Cortex-M, to reduce the interrupt latecy. This has been achieved by shortening the critical section in the PendSV exception. Also, this QK port to Cortex-M no longer uses the NMI exception. Finally, this release replaces all absolute paths with relative paths in all CCS-Eclipse project files (for TivaC, Hercules, and MSP430). @section qpn_5_6_5 Version 5.6.5, 2016-06-09 This release adds support for the new board: EFM32-SLSTK3401A (Pearl Gecko Starter Kit from Silicon Labs). This board replaces the Stellaris EK-LM3S811 board, which has been discontinued. (The Stellaris EK-LM3S811 board had been used in the "Fly 'n' Shoot" game example accompanying the PSiCC2 book). This release also introduces a new version of the QWIN GUI Toolkit in the Windows prototypes for the "Fly 'n' Shoot" game and the DPP-GUI version (see https://www.state-machine.com/products/index#QWIN). Additionally, this release also includes the QP-nano integration with the emWin emgedded GUI from SEGGER, which is also the same product as uC/GUI distributed by Micrium (@ref exa_emwin). Finally, this relase comes with updated project files for TI Code Composer Studio (both for ARM Cortex-M and for MSP430). This release fixes the following bugs: - bug#130 (POSIX port stop->start leads to reuse of sestroyed mutex). @section qpn_5_6_4 Version 5.6.4, 2016-04-25 This release fixes two serious bugs: - Bug #126 (https://sourceforge.net/p/qpc/bugs/126 ) in the QK preemptive scheduler introduced in QP 5.6.2. - Bug #128 (https://sourceforge.net/p/qpc/bugs/128 ) in the QK port to ARM Cortex-M introduced back in QP 5.6.1 @section qpn_5_6_2 Version 5.6.2, 2016-04-06 The main purpose of this release is to eliminate the need to define the QF_MAX_ACTIVE macro (the number of active objects) in qpn_conf.h header file and match it with the dimension of the QF_active[] global array. Instead, starting with this QP-nano version, the dimension of the QF_active[] array can be passed as the argument to the QF_init() function, as follows: QF_init(Q_DIM(QF_active)); @note For backwards compatibility the QF_MAX_ACTIVE macro, if defined, is still recognized and calling QF_init(Q_DIM(QF_active)) from main() is not necessary. Changes in detail: 1. Added internal variable QF_maxActive_ to store the number of active objects and replaced all occurrences of QF_MAX_ACTIVE with it. 2. Moved the implementation of QF_init() from qfn_init.c to qfn.c and changed it to take the maxActive argument. 3. Eliminated the source file qfn_init.c. 4. Modified the POSIX-QV port to use the new initialization strategy 5. Modified the WIN32-QV port to use the new initialization strategy 6. Removed the macro QF_MAX_ACTIVE from all examples and added call to QF_init(Q_DIM(QF_active)) instead. 7. Fixed the 3rd-party file startup_stm32l32l1xx.c to include exceptions for Cortex-M3 (MemManage_Handler, BusFault_Handler, and UsageFault_Handler). 8. Updated the 3rd-party files for the EK-TM4C123GXL board (TivaC LaunchPad). @section qpn_5_6_1 Version 5.6.1, 2016-01-11 This QP-nano release provides a new version of the QK-nano ports to ARM Cortex-M, which do not use the SVC_Handler (Supervisor Call). This is done to make the QK-nano ports compatible with various "hypervisors" (such as mbed uVisor or Nordic SoftDevice), which use the SVC exception. This release contains the updated QK-nano ports to ARM Cortex-M for all supported compilers: ARM-Keil, GNU-ARM, IAR EWARM, and TI-CCS-ARM. Changes in detail: 1. Modified the ARM Cortex-M QK-nano ports to not use the SVC_Handler. 2. Modified the GNU-ARM ports of QK for ARM Cortex-M, to use the __ARM_ARCH macro to distinguish among different architectures (ARCHv6 vs ARCHv7). 3. Added error directives to source files from different built-in kernels (QV and QK) to generate meaningful error messages when these files are mixed in one project. For example, a project based on QV will report errors when source files for QK-nano are included in it. 4. Updated CMSIS from 4.2 to 4.3 in qpn/3rd-party/CMSIS @section qpn_5_5_1 Version 5.5.1, 2015-10-06 This release adds state machine operations for implementing the shallow history mechanism. The operations are called QMsm_childStateObj() and QHsm_childState(), for QMsm and QHsm classes, respectively, because they compute a child state of a given parent, such that the child belongs to the same state hierarchy as the current state. This release also improves the AAPCS compliance of the ARM Cortex-M port to the QK preemptive kernel. Specifically, the PendSV handler in assembly did not always maintain the 8-byte stack alignment, which is required by AAPCS. This version corrects the stack misalignment in the qk_port.s files for all supported ARM compilers (ARM-Keil, GNU, IAR, and TI CCS). All these ports should also be ready for ARM Cortex-M7. Also, this release adds support for the TI CCS ARM compiler. Specifically, a new ARM Cortex-M ports have been added (in directories `qpn\ports\arm-cm\qk\ti\` and `qpn\ports\arm-cm\qk\ti\`) and TI CCS example projects have been provided (in directories `qpn\examples\arm-cm\dpp_ek-tm4c123gxl\qk\ti\` and `qpn\examples\arm-cm\dpp_ek-tm4c123gxl\qv\ti\`). Changes in detail: 1. Added the new prototypes QMsm_childStateObj() and QHsm_childState() to qepn.h 2. Added implementation of QMsm_childStateObj() and QHsm_childState() to qepn.c 3. Modified the qk_port.s assembly implementation for all supported ARM Cortex-M toolsets (ARM-Keil, GNU, IAR, and TI CCS) 4. Added QP-nano Cortex-M port to TI CCS. 5. Added CCS example projects in `qpn\ports\arm-cm\qk\ti\` and `qpn\ports\arm-cm\qk\ti\ @section qpn_5_4_2 Version 5.4.2, 2015-06-07 The main focus of this release is to improve the support for "dual targeting" of QP-nano applications, which is developing of deeply embedded code as much as possible on the desktop OS, such as Windows. Experience shows that "dual targeting" dramatically improves productivity of embedded systems developers, perhaps more than any other technique. This release makes it possible to use exactly the **same** application code, main function, and the Board Support Package interface (bsp.h) on both deeply embedded target and on Windows. The only differences between these targets can be completely encapsulated in the Board Support Package implementation (bsp.c). The support for "dual targeting" in this QP-nano release works both for Win32 console and Win32 GUI applications. The Win32-GUI support enables developers to easily emulate the front-panels of the embedded devices, with LCD-screens (graphical and segmented), LEDs, buttons, switches, sliders, etc. Changes in detail: 1. Modified the QP-nano port to Windows (@ref win32-qv) so that it supports both Win32 console and Win32-GUI applications. The newly introduced pre-processor #WIN32_GUI macro is now required to use the Win32-GUI facilities. 2. Added portable "safe" macros from `` and `` to the QP-nano port to Windows. These macros encapsulate the differences between Microsoft Visual C++ and other compilers (such as MinGW). 3. Simplified the structure of the QP-nano Windows port by eliminating one level of directories for the compilers used. Both VC++ and MinGW builds can now be run in the same port directory. 4. Modified the QF_stop() function in the QP-nano port to @ref win32-qv, so that it unblocks the QV event-loop and thus lets the application terminate. 5. Modified all examples for Windows to use the new port structure. 6. Improved all Makefiles (for the MinGW toolset) in all Windows examples, to make them easier to adapt to custom applications, both Win32 console and Win32 GUI. 7. Moved several examples from the `examples/win32/` and examples/win32-qv directories to `examples/arm-cm/` directory with native embedded examples for ARM Cortex-M. This co-location of the Win32 emulation with the embedded code running on the actual board demonstrates better the "dual targeting" development approach. 8. Made the ::QActiveCB (::QActive Control Block) to the QP-nano backwards-compatibility layer as deprecated. Instead, the newer QP-nano applications should use ::QMActiveCB. 9. Updated all Windows examples to the latest QP API by compiling the code with the macro #QP_API_VERSION set to 9999 (latest API without backwards compatibility) @section qpn_5_4_0 Version 5.4.0, 2015-05-31 This release changes the basic philosophy of packaging and distributing the QP-nano framework by **combining** the "QP-nano Baseline Code" with all currently available "QP-nano Development Kits" (QDK-nano). This is done to eliminate any potential mistakes in downloading and installing separate pieces of code. This release also changes the active object class hierarchy so that ::QMActive is now more fundamental and is the base class for ::QActive. (Previously ::QMActive was a subclass of ::QActive). The newly added documentation section about @ref classes "QP-nano Design" shows the current class hierarchy. @note Because the types ::QMActive and ::QActive are equivalent in QP-nano, this change has minimal impact on the applications, but it is now more correct to use ::QMActive as the base class for all "opaque" active object pointers. Additionally, this release alignes the QP-nano framework better with the rest of the QP framework family (QP/C and QP/C++), so that fewer changes are needed to move applications between QP-nano and QP/C. Finally, this release adds periodic time events (timers) to QP-nano. The feature is demonstrated by many provided examples (e.g., "Blinky", "Fly 'n' Shoot" game, PELICAN crossing). The aforementioned changes have also the following ripple effects: 1. The structure of the QP-nano ports has been modified to match QP/C and to avoid repetitions. The QP-nano application no longer need to provide and #include the complete port `qpn_port.h` header file, which is now deprecated. Insted QP-nano application code needs to #include the qpn.h (QP-nano API) header file, which also now contains the QP-nano backwards-compatibility layer. 2. The application is now only responsible for providing the qpn_conf.h file to set up the basic configuration for QP-nano. Examples of the `qpn_config.h` configurations are provided in all supplied QP-nano examples. 3. The actual port (e.g., the interrupt disabling policy for tasks and interrupts, interrupt entry/exit code, etc.) is included from the @ref ports folder. This @ref ports folder has been reorganized to contain all currently available QP-nano ports. The ports are organized into two categories: @ref ports_native "native QP-nano ports" ("bare-metal") and @ref ports_os "ports to big operating systems" (Windows and Linux).(**NOTE**: the ports are now documented in the this QP-nano Reference Manual. Each port sub-directory contains a README link to the corresponding page in the online documentation) 4. Expanded the QP-nano time events (timers) with the ability to fire periodically. The feature is controlled by the preprocessor switch #QF_TIMEEVT_PERIODIC. When this macro is defined (in the `qpn_config.h` header file), the signature of the QActive_armX() function contains one more `interval` parameter. The `interval` parameter allows you to specify the interval of the periodic timeout. If the `interval` is zero, the time event is one-shot. 5. It is no longer necessary to define the **QPN environment variable** to build the QP-nano examples. All directories and files referenced by example projects are **relative** to the project folder. This change reflects the fact that most development tools add source files to the project using relative paths. 6. The QP-nano @ref exa folder has been reorganized to reduce the repetitions and contains all currently available QP-nano examples. The folder includes four categories of examples: @ref exa_native "native QP-nano examples" ("bare-metal") and @ref exa_os "examples for big operating systems" (Windows and Linux). The examples folder has been expanded to contain all currently available QP-nano examples, many of them are new in this release. (**NOTE**: the currently available examples are now documented in the QP-nano Reference Manual. Each example sub-directory contains a README link to the corresponding page in the online documentation) 7. A new 3rd_party folder created to contain the Third-Party code used in the QP-nano ports and examples, such as MCU register files, low-level startup code, device drivers, etc. The 3rd_party folder avoids the need to repeat such code in every project. Also, the separation of the Third-Party components helps to clearly indicate code that comes from various sources, and to which Quantum Leaps, LLC expressly makes **no claims of ownership**. The Third-Party software components included in this "3rd_party" folder are licensed under a variety of different licensing terms that are defined by the respective owners of this software and are spelled out in the README.txt or LICENSE.txt files included in the respective sub-folders. 8. This release also comes with the much expanded online QP-nano Reference Manual, which is cross-linked with the ports and examples. Changes in detail: 1. Renamed the "Vanilla" scheduler to the @ref comp_qv "QV-nano cooperative kernel" for symmetry with the @ref comp_qk "QK-nano preemptive kernel". Renamed QF_onIdle() callback to QV_onIdle(). 2. Removed class ::QFsm (which is now deprecated). Legacy state machines coded in the "QFsm-style" will continue to work, but will use the ::QHsm implementation internally. There is no longer any efficiency advantage in using the "QFsm-style" state machines. 3. Updated @ref exa_arm-cm "ARM Cortex-M examples" and provided new examples for NXP mbed-LPC1768, and STM32 NUCLEO-L053R8, and NUCLEO-L152RE boards. All examples now use the latest CMSIS (V4.3.0). All ARM Cortex-M exampels are provided for the ARM-KEIL, GNU-ARM, and IAR-ARM toolsets. 4. Added the native @ref arm7-9 "port" and @ref exa_arm7-9 "examples" to the @ref arm7-9 "classic ARM7/9" with AT91SAM7S-EK board and the IAR-ARM toolset. 5. Added the native @ref avr "port" and @ref exa_avr "examples" to the AVR (AVRmega) with GNU-AVR and IAR-AVR toolsets. The @ref exa_avr "examples" are provided for the Arduino-UNO board. 6. Added the native @ref msp430 "port" and @ref exa_msp430 "examples" to MSP430 with TI CCS-430 and IAR-430 toolsets. The @ref exa_msp430 "examples" are provided for the MSP430 LauchPad boards (the MSP-EXP430G2 and MSP-EXP430F5529LP for the "classic" MSP430 and "extened" MSP430X, respectively). 7. Updated @ref win32-qv "port to Win32-QV" (Windows with cooperative "Vanilla" scheduler, previously known as Win32-1T). Modified the port to apply a "fudge factor" in over-sizing QP-nano event queues and event pools, to minimize the risk of overflowing queues/pools due to non-deterministic Windows behavior. 8. Renamed the POSIX port to @ref posix-qv "POSIX-QV" (POSIX with cooperative "Vanilla" scheduler). Modified the port to apply a "fudge factor" in over-sizing QP-nano event queues and event pools, to minimize the risk of overflowing queues/pools due to non-deterministic behavior under POSIX. @section qpn_5_3_0 Version 5.3.0, 2014-04-18 This release adds the "transition to history" (deep history) feature to both QHsm and QMsm state machines and their subclasses. This QP-nano release matches the new QM modeling tool Version 3.1.0, which now supports the "transition to history" connector and the corresponding code generation for transitions to history. @note QP-nano 5.3.0 breaks backwards-compatibility with QP-nano applications developed for QP-nano 4.x and 5.x. However, the update to QP-nano 5.3.0 typically requires only to add #include and #include "qassert.h" to the qpn_port.h header file in the application directory. Any QM models created for the previous QP-nano versions remain fully compatible with QP-nano 5.3.0, but you need to re-generate the code with QM 3.1.0. This release comes with new and updated QDKs for MSP430. Specifically, new QDKs have been added for the MSP-EXP430G2 LaunchPad as well as the MSP-EXP420F5529LP LauchPad. Also, the QDKs for MSP430 with the TI Code Composer Studio are now part of the baseline QP-nano distribution. This release also goes several steps towards compliance with the new MISRA-C:2012 rules. For example, unused tag declarations have been removed (MISRA-C:2012 Rule 2.4), the C99 standard Boolean data type in has been added instead of uint8_t for stricter type analysis, and the C99 data types uint_fast8_t and uint_fast16_t are used instead of the non-standard uint_t. Finally, this QP-nano release brings deep changes in the source code comments and the doxygen documentation generated from the source code. All comments have now more consistent structure, and every function is now documented in the implementation file (.c file), whereas the interface (.h files) contain only the brief descriptions of the functions. This re-structuring of documentation is performed as part of the validation and verification effort that has begun to provide a certification package for QP-nano for safety standards, such as IEC 61508 and ISO 62304 (FDA 510(k)). Changes in detail: 1. Moved detailed documentation of functions from the header files (.h) to implementation files (.c). 2. Added macros: Q_TRAN_HIST(), QM_TRAN_HIST(), and QM_TRAN_EP(), to "qepn.h" 3. Added attributes entryAction and initAction to the QMState struct in "qepn.h" (needed for transition to history). 4. Changed return type to bool in virtual functions QMsmVtbl.post() and QMsmVtbl.postISR() as well as the implementations: QActive_postX_(), and QActive_postXISR_(). 5. In qepn.h, changed the QState return type from action/state handler functions to uint_fast8_t. 6. In qfn.h, changed the type of QActive attributes prio, head, tail, and nUsed to uint_fast8_t. 7. In qfn.h, changed the type of of QTimeEvtCtr, as well of the tickRate argument in QF_tickXISR(), QActive_armX(), and QActive_disarmX() to uint_fast8_t. 8. Changed the return type from QK_schedPrio_() (priority) as well as the p argument in QK_sched_() to uint_fast8_t 9. Added new QDKs-nano/IAR for MSP-EXP430G2 LaunchPad 10. Added new QDKs-nano/IAR for MSP-EXP420F5529LP LauchPad LaunchPad 11. Added new QDKs-nano/CCS for MSP-EXP430G2 LaunchPad 12. Added new QDKs-nano/CCS for MSP-EXP420F5529LP LauchPad LaunchPad @section qpn_5_2_0 Version 5.2.0, 2013-12-30 This release matches the new QM 3.0.0, for which it provides model examples based on the new QMsm/QMActive classes. This, in turn demonstrates the new state machine code generation that QM3 was specifically designed to do. This release also provides consistent API for late-binding ("virtual" functions) introduced in QP-nano 5.0.0, as opposed to using regular linking (early-binding) for direct function calls, such as QHsm_dispatch(). A clearly separated API compatibility layer is provided, whereas you can configure a level of backwards compatibility by means of the #QP_API_Version macro. This facilitates migrating existing QP applications to the newer API. An cyclomatic complexity (McCabe V(G)) analysis of this Version has been performed and the maximum V(G) complexity per function has been reduced to 15 by breaking up the QHsm_dispatch_() function. The code metrics report, including cyclomatic complexity by function as well as other standard code metrics (e.g., lines of code), is now included in the "QP-nano Reference Manual", see https://www.state-machine.com/qpn/metrics.html Finally, this release demonstrates safer stack allocation and safer exception handlers in all ARM Cortex-M examples. The techniques are described in the Embedded.com article "Are We Shooting Ourselves in the Foot with Stack Overflow?". Changes in detail: 1. In file qepn.h renamed the implementation functions, such as QHsm_init() and QHsm_dispatch() to QHsm_init_() and QHsm_dispatch_() (note the underscore, which means that the functions should not be called directly by the application code). The only correct way of calling the functions is through the macros QMSM_INIT() and QMSM_DISPATCH(), respectively. The latter macros implement late-binding ("virtual" functions in C). 2. In file qfn.h renamed the implementation functions, such as QActive_postX() and QActive_postXISR() to QActive_postX_(), and QActive_postXISR_, respectively (note the underscore, which means that the functions should not be called directly by the application code). The only correct way of calling the functions is through the macros QACTIVE_POST(), QACTIVE_POST_X(), QACTIVE_POST_ISR() and QACTIVE_POST_X_ISR(). The latter macros implement late-binding ("virtual" functions in C). 3. for backwards compatibility, in files qepn.h and qfn.h defined "API Compatibility Layer", which is controlled by the macro #QP_API_VERSION. For example, specifying QP_API_VERSION=500 chooses API compatible with QP Version 5.0.0 or newer, but excludes APIs that became deprecated in the earlier versions. If the macro #QP_API_Version is not defined by the user (typically on the command line for the compiler), the default value of 0 is assumed. This default means maximum backwards compatibility (from Version 0.0.0). On the other hand, higher values of #QP_API_Version mean less backwards compatibility. For example QP_API_VERSION=9999 will specify compatibility only with the latest Version of QP-nano. The API Compatibility Layer for QP_API_Version < 500 provides macros: QHsm_init(), QHsm_dispatch(), QActive_post() and QActive_postISR(). These macros resolve to QMSM_INIT() and QMSM_DISPATCH(), QACTIVE_POST() and QACTIVE_POST_ISR() respectively, so that calls based on the older API also use late-binging. 4. In file qepn.c, broken up the function QHsm_dispatch() into two functions QHsm_dispatch_() and QHsm_tran_(). This has reduced the cyclomatic complexity from 25 for the original function, to 11 and 15 for QHsm_dispatch_() and QHsm_tran_(), respectively. 5. Updated all examples for ARM Cortex-M to use safer stack allocation and safer exception handlers in all ARM Cortex-M examples, as described in the Embedded.com article "Are We Shooting Ourselves in the Foot with Stack Overflow?". @section qpn_5_1_1 Version 5.1.1, 2013-10-15 @note QP-nano 5.1.1 remains backwards-compatible with the existing QP-nano 4.x applications, except QP-nano 5.1.x requires changing the interrupt priority setting in the existing ARM Cortex-M applications. Specifically, you need to set the interrupt priorities equal or lower than QF_AWARE_ISR_CMSIS_PRI constant provided in the qfn_port.h header file. The main purpose of this milestone QP-nano release is to enable the QM modeling tool to generate a new type of state machine code (requires QM Version 3.0.0, which is still in development as of this writing). This new type of state machine implementation in QP-nano 5 is based on the new QMsm class, which takes advantage of the QM tool as an advanced "state machine compiler". QM can perform optimizations that were not possible with the C preprocessor alone. Specifically, the QM can easily determine the LCA (Least-Common-Ancestor) state for every transition and it can generate the complete transition-sequences (sequences of exit/entry/initial actions) at code-generation time. The resulting code can be still highly human-readable, but it will no longer be human-maintainable. The lab tests indicate that the new "housekeeping" code for executing hierarchical state machines can be about twice as fast as the previous code based on the QHsm class. Additionally, the new code requires less run-time support (smaller event processor) and uses 70% less of stack space in the call to the QMsm_dispatch() operation than QHsm_dispatch(). The next big feature introduced in QP-nano 5 is polymorphism ("virtual" functions) for basic operations, such as state machine init() and dispatch() and active object post(), and postISR() operations. Making theses functions "virtual" means that all these operations can be re-defined in sub-classes of state machines and active objects. This, in turn, allows a single application to use a mix of state machine classes derived from the new QMsm base class with state machines derived from the QHsm base class, each one using a different state machine implementation strategy. Additionally, the virtual post() operation could be very useful for implementing various Proxy active objects (e.g., for active object event posting across networks). Another big feature introduced in QP-nano 5 are the multiple, independent system clock tick rates for time events. The number of system tick rates can be now configured in the QP-nano ports. For example, a digital watch can use a "fast" clock tick rate of 100Hz and a "slow" clock tick rate of only 1Hz. These clock tick rates can be managed independently, so for example, the fast clock tick rate can be shut down in the absence of time events assigned to this rate. This feature allows the applications to implement sophisticated power-saving policies. As yet another important feature, QP-nano adds a new "extended" API for non-asserting event allocation and posting. This feature is intended for situations, where an application is hammered with external events that at times arrive too fast for processing, but that can be ignored under the overload conditions. In those cases firing an assertion inside the framework is undesirable. The non-asserting API allows a designer to request a safety-margin when allocating or posting an event. The event is not allocated/posted if the safety margin cannot be satisfied at the time of the call. On the other hand, the safety margin allows the application to still use the regular (asserting) event allocation and posting, because the event pools and event queues are guaranteed to maintain a minimal margin for safe operation. Finally, QP-nano 5.1.0 never completely disables interrupts in the ARM Cortex-M3/M4 cores, even inside the critical sections. On Cortex-M3/M4 (ARMv7-M architectures), the QP port disables interrupts selectively using the BASEPRI register. (NOTE: The BASEPRI register is not implemented in the ARMv6-M architecture (Cortex-M0/M0+), so Cortex-M0/M0+ need to use the PRIMASK register to disable interrupts globally). This new policy of disabling interrupts divides interrupts into "kernel-unaware" interrupts, which are never disabled, and "kernel-aware" interrupts, which are disabled in the QP critical sections. Only "kernel-aware" interrupts are allowed to call QP services. "Kernel-unaware" interrupts are *NOT* allowed to call any QP services and they can communicate with QP only by triggering a "kernel-aware" interrupt (which can post or publish events). As mentioned above, all QP ports to ARM Cortex-M included in the QP 5.1.x Baseline Code provide the constant QF_AWARE_ISR_CMSIS_PRI, which must be used to offset the "kernel-aware" interrupt priorities. All example projects for ARM Cortex-M included in the QP-nano 5.1.x Baseline Code demonstrate the recommended way of assigning interrupt priorities in your applications. The initialization consist of two steps: 1. you enumerate the "kernel-unaware" and "kernel-aware" interrupt priorities (whereas you offset the "kernel-aware" priorities by the constant QF_AWARE_ISR_CMSIS_PRI) and 2. you assign the priorities to *ALL* interrupts by calling the NVIC_SetPriority() CMSIS function. **** NOTE: Leaving the interrupt priority at the default value of zero (the highest priority) is most likely incorrect, because the "kernel-unaware" interrupts cannot call any QP services. **** For more information, please read the short Application Note "Setting ARM Cortex-M Interrupt Priorities in QP 5.1" available at: https://www.state-machine.com/arm/AN_ARM-Cortex-M_Interrupt-Priorities.pdf. The following list details the changes: 1. Added the new QMsm "class" to qepn.h. Changed the inheritance tree by deriving QHsm and QFsm from the QMsm base class. Added virtual table structures for QMsm, QHsm, and QFsm (polymorphism). - added macro QMSM_INIT() to polymorphically call the state machine initialization implementation in the QMsm base class and all subclasses. - added macro QMSM_DISPATCH() to polymorphically call the state machine event dispatching implementation in the QMsm base class and all subclasses. 2. Added the new "QMActive" "class" to qfn.h. Extended the inheritance tree to derive QMActive from QActive. Added virtual table structures for QMActive and QActvie (polymorphism). - added macro QACTIVE_POST() to polymorphically call the direct event posting to an active object. - added macro QACTIVE_POST_ISR() to polymorphically call the postISR (posting from interrupts) to an active object. 3. Added the multiple system clock tick rates feature in qfn.h: - added new configuration macro QF_MAX_TICK_RATE, which specifies the number of clock tick rates. This macro is to be defined in the QF ports (in the qpn_port.h header file). If the macro is undefined, the default value is 1 (one clock tick rate). - renamed and re-implemented the QF_tickISR() function as the "extended" QF_tickXISR() function with the argument 'tickRate' for processing time events allocated to different clock rates. The application must call QF_tickXISR(0), QF_tickXISR(1), ... at the specified tick rates from ISRs or *tasks*. - renamed and re-implemented the internal function QTimeEvt_arm_() to a public function QActive_armX() for arming time events initialized with the "extended" constructor. The QActive_armX() function is the new recommended API for arming time events, both one-shot and periodic. - re-implemented QActive_disarm(). - extended QF_timerSetX_ to an array of [QF_MAX_TICK_RATE], so that every rate can be checked independently. 4. Added the new non-asserting API to qf.h: - added functions QActive_postX() and QActive_postXISR() to post an event to the given active object. The functions do not post the event if the target event queue has less free slots than the specified margin. The functions assert if the margin is zero and the event can't be posted. 5. Changed the structure of the ARM Cortex-M ports - renamed the sub-directory for ARM Cortex-M ports and examples from "arm-cortex" to "arm-cm". This is done to avoid confusion with other ARM Cortex variants, such as Cortex-A/R, which very different from Cortex-M. - removed the CMSIS (Cortex Microcontroller Software Interface Standard) directories from the Cortex-M examples and moved it to the common location in the %QPN%/ports/arm-cm/cmsis/ directory. Upgraded the CMSIS to the latest Version 3.20. - added the ARM Cortex-M ports and examples with Keil/ARM MDK to the QP Baseline Code. - upgraded ARM Cortex-M ports with IAR to the latest IAR EWARM 6.60 - upgraded ARM Cortex-M ports with Sourcery CodeBench to the latest Version 2013.05-53. 9. Added the requested simple "Blinky" example for Windows and ARM Cortex-M (with the GNU, IAR, and Keil toolsets). - Added "Getting Started with QP-nano" guide based on the Blinky example. 10. Modified the application examples with PC-Lint (qpn/examples/arm-cm/gnu/dpp-qk_ek-lm3s811-lint and qpn/examples/arm-cm/iar/dpp-qk_ek-lm3s811-lint). Updated lint files for the latest PC-Lint 11. Ported all state pattern examples to Win32/MinGW. That way, all these examples can be run and modified directly on Windows, without going back to DOS. 12. Updated the Doxygen documentation (QP-nano Reference Manual) - updated the QP-nano tutorial - updated and added documentation and code samples - added search box and tree-view panel to the HTML documentation @section qpn_4_5_04 Version 4.5.04, 2013-02-09 The main purpose of this release is adding support for the ARM Cortex-M4F processors with the hardware Floating-Point Unit (FPU). The QP-nano ports to Cortex-M4F take full advantage of the "lazy stacking" feature of the FPU registers, and by doing so offer the most efficient preemptive multitasking on this processor. Changes in detail: 1. Added ports and examples for ARM Cortex-M4F with the EK-LM4F120XL board (Stellaris Launchpad). 2. Added the macro QF_LOG2(), which can be re-implemented in the QP-nano ports, if the CPU supports special instructions, such as CLZ (count leading zeros in Cortex-M3/M4). If the macro is not defined in the QP port, the default implementation uses a lookup table. 3. Updated all ARM Cortex-M ports and examples to the latest IAR EWARM 6.50 and Sourcery CodeBench 2012.09-85. 4. Updated App Notes "QP and ARM Cortex-M with IAR" and "QP and ARM Cortex-M with GNU". 5. Updated the PC-Lint support files (`lib-qpn.lnt`, `au-misra2.lnt`) to the latest PC-Lint 9.00j. 6. Updated the Application Note: "QP-nano MISRA-C:2004 Compliance Matrix". 7. Spell-checked the comments in all QP-nano source files and removed several typos. 8. Removed the Qt ports and examples from the QP-nano Baseline Code and @note QP-nano Version 4.5.04 preserves full compatibility with QM 2.2.03 and all existing QDKs for QP-nano 4.5.xx. @section qpn_4_5_03 Version 4.5.03, 2012-11-29 This release changes the directory structure of QP-nano examples for various operating systems, such as POSIX (Linux, BSD, etc.), Win32 (Windows), Qt, etc. The OS examples are moved from the exampels/80x86/ directory one level up to examples/. @section qpn_4_5_02 Version 4.5.02, 2012-08-17 The main purpose of this release is providing QM models in most examples and better, more comprehensive support for (rapid) prototyping of embedded QP applications on the desktop with the Win32 API and with Qt. Among others, this release adds a complete toolkit for creating realistic embedded front panels with pure Win32-GUI API and free Visual C++ Express and ResEdit. An extensive Application Note "QP and Win32" is included in this release. This QP relase adds QM models, created with the new QM 2.2.01, to most of the examples. The code generated by this new QM version complies with MISRA-C:2004 rules. This release adds the variable QF_timerSet_ and bookkeeping around it, so that the state of all timeouts in the system can be determined quickly and efficiently. This feature is for power- sensitive applications, where the system clock tick interrupt needs to be turned off. One of the criteria to entering such a sleep mode is that all timeout events are disarmed, that is, when (QF_timerSet_ == (uint8_t)0). Changes in detail: 1. Added QF_timerSet_ declaration to qfn.h and setting/clearing this bitmask into qfn.c and qfn_init.c. This feature is controled by the configuration macro Q_TIMERSET. 2. Modified QP-nano port to Win32 and used the free Visual C++ Express 2010 with Platform SDK rather than Visual C++ Pro 2008. Provided a completely revised App Note "QP and Win32". 3. Renamed the port directory qt_1t/ to qt/. 4. Added QM models to most examples and used the automatically generated code from the models instead of the hand-written code. 5. Added .ui files to the Qt examples for generating UIs graphically with the Qt Designer tool. Revised and updated the App Note "QP and Qt". 6. Removed definition of the macro QF_FSM_ACTIVE from qpn_port.h files in /examples/80x86/watcom/dpp and /examples/80x86/watcom/game. This configuration conflicted with the actual definition of the active objects, which used *hierarchical* state machines, not the "flat" state machines. @section qpn_4_5_01 Version 4.5.01, 2012-06-14 The main purpose of this minor release is providing improved MISRA-compliant state machine implementation. Specifically, a new macro Q_UNHANDLED() has been added for a situation when a guard condition evaluates to FALSE, but the state model does not prescribe the explicit [else] case for this guard. In this case, the state handler can return Q_UNHANDLED(), which will cause the QEP event processor to propagate the event to the superstate, which is what UML semantics prescribes. NOTE: These change to the QEP-nano event processor is completely backwards-compatible. All state hander functions coded the old way will continue to handle the guard conditions correctly and in accordance with the UML specification. The new Q_UNHANDLED() macro is necessary only for MISRA-compliant state handler coding, which will be applied in the upcoming release of the QM modeling and code generation tool. Changes in detail: 1. Added macro Q_UNHANDLED() and return value Q_RET_UNHANDLED in qepn.h. 2. Modified qepn.c to handle the Q_RET_UNHANDLED return value. 3. Updated the QP-nano MISRA-C:2004 compliance matrix to include the new MISRA-compliant way of coding guard conditions. 4. Updated the IAR ARM compiler used in the ARM Cortex-M examples to the latest Version IAR EWARM 6.40. 5. Modified the Qt port not to define the QPApp::onClockTick() slot, but instead to allow defining this slot in the BSP of the application. @section qpn_4_5_00 Version 4.5.00, 2012-05-30 The main pupose of this relase is to improve host-based development of QP-nano applications, which is critical for Test-Driven Development (TDD). Among others, this release provides integration between QP-nano and the popular Qt GUI framework, which allows developers to easily build host- based simulations of the embedded systems with the realistic user interfaces. This realase also simplifies implementing transitions to history, which is a preparation to providing this feature in the QM modeling tool. Changes in detail: 1. Renamed the event class from QEvent to QEvt to avoid a name conflict with the Qt framework. NOTE: To minimize impact of this change on the existing QP-nano ports and applications, the name QEvent is provided as well, but this can be suppressed by defining the configuration macro Q_NQEVENT in qep_port.h. 2. Added return value to QF_run() to allow transfer of the exit status to the destop operating systems. NOTE: This modification haves impact on most QP-nano ports, because the QF_run() function must now return a int16_t value. 3. Added member 'temp' to the QHsm and QFsm base classes to prevent clobbering the current state (the 'state' member) during transitons. This change allows keeping the current state unchanged during the entire transition chain, which in turn allows easy and generic access to the state information to store the state history in the exit actions from states. Additional bonus of this re-design is the opportunity of testing for stable state configuration in assertions added to the qepn.c file. 4. Added the QHsm_state() and QFsm_state() accessor macros. 5. Modified the "Transition to History" pattern implementation to use the simplified technique of obtaining the current state in the exit action from the superstate rather than all the exit actions from the substates. Modified the "State-Local Storage" (SLS) pattern as well, because it was using the transition to history constructs. 6. Modified the QP-nano port to Win32 (both the MinGW and VC2008). 7. Modified the QP-nano port to POSIX. 8. Added QP port to Qt (Qt with one thread) and two example applications (DPP and PELICAN crossing). 9. Added GNU compiler option -pthread to QP ports for POSIX with P-threads, including QP ports and examples for Linux and Mac OS X. @section qpn_4_4_00 Version 4.4.00, 2012-03-03 The main pupose of this relase is MISRA-C:2004 compliance, strong-type checking compliance, update of PC-Lint option files and tests, and general cleanup. 1. For commonality with the QP/C and QP/C++ frameworks renamed macros QF_INT_LOCK/QF_INT_UNLOCK to QF_INT_DISABLE/QF_INT_ENABLE, respectively. Also renamed macros QF_INT_KEY_TYPE/QF_ISR_LOCK/QF_ISR_UNLOCK to QF_ISR_STAT_TYPE/QF_ISR_DISABLE/QF_ISR_RESTORE, respectively. NOTE: This modifications have impact on most QP-nano ports. However, the qfn.h header file contains definitions of the new macros in terms of the old ones. This provies backwards comatibility of the existing QP-nano ports. 2. Added the PC-Lint option files std.lnt and lib-qpn.lnt to the qcn/include/ directory. 3. Cleaned the whole QP-nano code from lint comments. All PC-Lint options have been moved to PC-Lint option files. 4. Modified QP-nano assertion macro Q_DEFINE_THIS_MODULE() to avoid using the # operator (MISRA rule 19.13). This macro now requires the argument enclosed in doble quotes "". NOTE: This modification has impact on some QP-nano ports. 4. Added typedefs for char_t, int_t, float32_t, and float64_t to event.h header file for compliance with MISRA-C:2004 rules 6.1 and 6.3. 5. Added macros Q_STATE_CAST() and Q_ACTIVE_CAST() to qep.h to encapsulate deviation from MISRA-C rule 11.4. 6. Added macro Q_UINT2PTR_CAST() to encapsulate casting unsigned integers to pointers, which deviates from MISRA-C rule 11.3. This macro has been added for *application-level* code. 7. Updated ARM Cortex-M examples with the latest CMSIS v3.0, which complies with more MISRA-C:2004 rules. 8. Added PELICAN examples for MISRA-C:2004 compliant applications (for IAR-ARM and GNU-ARM). 9. Added testing of PC-Lint option files against the MISRA-C Exemplar Suite. 10. Updated ARM-Cortex-M3 port with GNU to the latest Sourcery CodeBench 2011.09-60. 11. Added documentation to QP-nano distribution in the directory qpn/doc/, with the following Application notes: "QP-nano MISRA-C:2004 Compliance Matrix" and "Quantum Leaps Coding Standard", @section qpn_4_3_00 Version 4.3.00, 2011-10-31 1. This release changes the partitioning of the QK-nano scheduler. Specifically, the QK-nano scheduler is now divided between two functions QK_schedPrio_() and QK_sched_(), to calculate the highest- priority task ready to run and to perform scheduling, respectively. The function QK_schedPrio_() is useful to determine if scheduling is even necessary. 2. Reduced the interrupt latency of the QK-nano kernel by breaking up the critical section in the QK_sched_() into two pieces, just after setting QK_currPrio_. 3. Modified the ARM Cortex-M port qkn_port.s to take advantage of the new structure of the QK-nano scheduler. To reduce code duplications, the QK-nano port file qkn_port.s has been placed in the directories: qpn/ports/arm-cortex/qk/gnu/ for the GNU compiler and qpn/ports/arm-cortex/qk/iar/ for the IAR compiler, respectively. 4. Moved the Win32 and POSIX emulation of QP-nano from the directory qpn/emulation/ to qpn/ports/win32/ and qpn/ports/posix/, respectively. 5. Renamed the function QF_tick() to QF_tickISR() to clearly notify the user that this function is callable from ISR only. For backwards compatibility, the macro QF_tick() is defined to QF_tickISR(). 6. Modified QF_tickISR(), QActive_postISR(), QActive_post(), and QK_sched_() to use stack-based pointer to QActiveCB, which avoids re-computation of the pointer on-the-fly in the loop. According to the feature request #3403079, this significantly speeds up the code for 8-bit PIC micros. 7. Upgraded the examples for ARM Cortex with IAR EWARM to the latest IAR EWARM Version 6.30. 8. Upgraded the examples for ARM Cortex with GNU (CodeSourcery) to the latest Sourcery CodeBench 2011.07-60. @section qpn_4_2_04 Version 4.2.04, 2011-09-24 The main pupose of this relase is to provide a bug fix for the QK port to ARM Cortex processors. The bug fix addresses a very rare and undocumented behavior of late-arrival of an interrupt while entering the PendSV exception. In this case the PENDSVSET bit in the NVIC-ICSR register is *not* cleared when finally PendSV is entered, so the PendSV exception is entered in a *different* state when it is entered via the late-arrival mechanism versus the normal activation of the exception through tail-chaining. The consequence of this undocumented and inconsistent hardware behavior, PendSV could be re-entered again before the SVCall exception cleans up the stack. The bug fix is implemented in the qk_port.s file (in QP-nano this file is replicated in every example for QK-nano) and consists of clearing the PENDSVSET bit programmatically inside PendSV_Handler. @section qpc_4_2_02 Version 4.2.02, 2011-09-08 The main pupose of this relase is to repackage the default QP-nano distribution to contain the single root directory qpn/ in the archive. That way, unziping the archive will produce only one directory (qpn/), which can be then changed by the user. @section qpn_4_2_01 Version 4.2.01, 2011-08-13 1. Modified file qassert.h to add assertion macros #Q_ASSERT_ID, #Q_REQUIRE_ID, #Q_ENSURE_ID, #Q_INVARIANT_ID, and #Q_ERROR_ID, which are better suited for unit testig, because they avoid the volatility of line numbers for indentifying assertions. 2. Modified the make files and project files to use the environment variable QPN instead of relying on the relative path to the QP-nano framework. 3. Added QP-nano examples for Mac OS X on 80x86. 4. Upgraded the examples for ARM Cortex with IAR EWARM to the latest IAR EWARM Version 6.20. 5. Upgraded the examples for MSP430 with IAR EW430 to the latest IAR EW430 Version 5.30. @section qpn_4_1_07 Version 4.1.07, 2011-02-28 The goal of this release is to improve the ease of experimenting with QP-nano on the desktop. This release adds support for Windows (Win32) and Linux to the QP-nano baseline code. Two most popular compilers for Windows are supported: Microsoft Visual Studio and MinGW (GNU). The support for Linux includes pre-built examples and makefiles compatible with Eclipse. The changes in detail are: 1. Added sub-directory qpn/emulation with emulation code for Windows (win32) and POSIX (Linux, Mac OS X, etc.). 2. Added Win32 examples for Visual C++ 2008 (examples/80x86/win32/ vc2008/dpp and examples/80x86/win32/vc2008/qhsmtst). Visual Studio soultions are provides for all build configurations. 3. Added Win32 examples for MinGW (examples/80x86/win32/mingw/dpp and examples/80x86/win32/mingw/qhsmtst). Eclipse-compatible makefiles are provided for all build configurations. NOTE: the Makefiles assume that the MinGW/bin directory is added to the PATH. 4. Fixed a bug in file qfn.c, function QActive_postISR(). For special rare combination of configuration macros the assertion was checked before declaring an automatic variable QF_ISR_KEY_TYPE key. This declaration has been moved to the top of the function. 5. Upgraded the examples for ARM Cortex with CodeSourcery to the latest Sourcery G++ 2011.02-2. @section qpn_4_1_06 Version 4.1.06, 2011-01-07 1. Made cosmetic improvements to the example QM model of the "Fly 'n' Shoot" game. 2. Made improvements in make.bat files for building the examples for DOS/Open Watcom to run better in DosBox on Linux. 3. Upgraded the examples for ARM Cortex with IAR to the latest IAR EWARM Version 6.10. 4. Upgraded the examples for ARM Cortex with CodeSourcery to the latest Sourcery G++ 2010.09-66. @section qpn_4_1_05 Version 4.1.05 (Product) Nov 01, 2010 This release is adds examples for the QM (QP Modeler) graphical modeling and code generation tool. The examples are based on the "Fly 'n' Shoot" game described in the QP-nano Tutorial and in Chapter 1 of the PSiCC2 book. Specifically, the directory qpn/examples/80x86/watcom/game-qm/ contains the "Fly 'n' Shoot" game model file "game.qm". This model, when opened in the QM tool contains all state machine diagrams and generates code into the subdirectory qm_code/. This code can then be built and executed on any 80x86 machine (newer versions of Windows or Linux require the DOSbox application, see http://www.dosbox.com). The directory qpn/examples/arm-cortex/iar/game-ev-lm3s811-qm/ contains the Version of the game for the EV-LM3S811 ARM Cortex-M3 board. This directory contains the model file "game.qm", which is actually identical as the model in the DOS version. The LM3S811 Version needs to be compiled with the IAR compiler and executed on the EV-LM3S811 board. Additionally, the QP-nano baseline code has been slighlty modified for better conformance to the MISRA C 2004 rules and the latest PC-Lint 9.x. @section qpn_4_1_04 Version 4.1.04, 2010-03-16 This release is adds compatibility of all examples for DOS with the DOSBox emulator (http://www.dosbox.com/) that recreates a MS-DOS compatible environment on all versions of Windows, including 64-bit Windows that don't run 16-bit DOS applications anymore. Also, this release includes QP ports and examples for EV-LM3S811 board with the GNU-based Code Sourcery G++ toolset. Support for Sourcery G++ provides a very cost-effective option for developing QP applications for ARM Cortex MCUs. Finally, this release improves the Cortex Microcontroller Software Interface Standard (CMSIS) for the whole family of the Stellaris LM3Sxxx MCUs. The improvement extends the CMSIS from Sandstorm to Fury, DustDevil, and Tempest Stellaris families. @section qpn_4_1_03 Version 4.1.03, 2010-01-21 This release is concerned with the ARM Cortex ports and examples. Specifically, this release contains the following improvements: 1. Unified source code for ARM Cortex-M3 and the new ARM Cortex-M0 cores, including the code for the preemptive QK kernel. 2. Compliance with the Cortex Microcontroller Software Interface Standard (CMSIS) in all ARM Cortex examples. 3. Backward-compatible support for the new LM3S811 EVAL Rev C board with different OLED display than previous revisions. (NOTE: The OSRAM 96x16x1 OLED used in REV A-B boards has been replaced RITEK 96x16x1 OLED used in Rev C.) In the process of making the examples CMSIS-compliant, the dependency on the Luminary Micro driver library (driverlib.a) has been completely removed. Additionally, the screen saver of the "Fly 'n' Shoot" game has been improved to periodically switch off the power of the OLED display, which better protects the display from burn-in. The affected file is tunnel.c. Finally, this release introduces the QP_Version macro, which identifies the QP version. Otherwise, this maintenance release does not change the QP/C API in any way, so the release has NO IMPACT on the QP/C applications except for the ARM Cortex ports and applications. @section qpn_4_1_02 Version 4.1.02, 2010-01-14 The purpose of this minor maintenance release is the change in the directory structure for the ARM Cortex ports and examples. As new ARM Cortex cores are becoming available, the old port name "cortex-m3" could be misleading, because it actually applies to wider range of ARM Cortex cores. Consequently, all ARM Cortex ports and examples are hosted in the directory tree called "arm-cortex". This maintenance release does not change the QP-nano API in any way, so the release has NO IMPACT on the QP-nano applications except for the ARM Cortex ports and applications. @section qpn_4_1_01 Version 4.1.01, 2009-11-05 The main purpose of this release is to replace the Turbo C++ 1.01 toolset with the Open Watcom C/C++ toolset, because Turbo C++ 1.01 is no longer available for a free download. In contrast, Open Watcom is distributed under an OSI-certified open source license, which permits free commercial and non-commercial use. Open Watcom can be downloaded from www.openwatcom.org. All 80x86 examples (vanilla and QK-nano) for Turbo C++ 1.01 have been replaced with examples for Open Watcom. The make.bat scripts are provided to build the examples. In the process of converting the examples to Open Watcom a new SLS example have been added to the standard QP-nano distribution. The SLS example located in <qpn>/examples/80x86/watcom/sls/ shows the QP-nano implemenation of the new State-Local Storage state design pattern. @section qpn_4_1_00 Version 4.1.00, 2009-10-09 The main purpose of this release is to fix a bug in event posting, which could cause corruption of the event signal. Such corruption could occur when an event was posted to an empty event queue, in which case it was written directly to the internal event stored in the state machine, bypassing the ring-buffer. However, the signal of the internal event could also be changed by the QEP-nano event processor during execution of transitions. The bug fix is to always pass events through the ring buffer and never overwrite the internal event during event posting (both from the task level and from the ISR level). The update of the ring buffer always occurs within a critical section and is safe from interruptions. This bug fix also allows posting of events from the top-most initial transitions of active objects during the initialization phase. Previously, the execution of the top-most initial transition corrupted the signal of the internal event. The bug fix enables also self-posting of events from entry/exit actions and internal initial transitions. Again, the QEP event processor corrupted the internal signal. This release also replaces the static variables 'p' (priority) and 'a' (active object pointer) with automatic variables. This change results in more efficient code, because the frequently used variables can be kept in registers and do not need to be read/written from/to memory by each use. Additionally, this release updates the QP-nano ARM Cortex-M3 examples for the EK-LM3S811 board to the latest IAR EWARM 5.40. Due to the acquisition of Liminary Micro by Texas Instruments the directory IAR structure for the examples and drivers has changed and the QP-nano examples had to be changed accordingly. Finally, this release fixes a bug in the "Fly 'n' Shoot" game example for QP-nano, which caused an assertion if the Ship was moved to the very top of the Tunnel. This was due to the y-coordinate of the ship explosion becomoming negative. NOTE: This release does not change the QP-nano API, but all event queues are effectively shortened by one event. Also it is no longer possible to declare an active object without a ring buffer (zero-sized queue), because the internal event no longer counts towards the queue depth. The main changes in QP v4.1.00 with respect to the earlier versions are as follows: - modified functions QActive_post(), QActive_postISR(), and QF_run() in qfn.c to always use the ring buffer and not to count the internal event as part of the queue (in the assertions). - modified qfn.c to replace static variables 'p' and 'a' with automatic variables. - modified function QK_schedule_() in qkn.c to always use the ring buffer, as described above. - modified module qkn.c to to replace static variables 'p' and 'l_act' with automatic variables. - modified various examples to eliminate zero-sized queues and extend event queues by one event. - modified the ARM Cortex-M3 examples for the new IAR EWARM 5.40. - modified the ship.c and tunnel.c files in the "Fly 'n' Shoot" game example to fix the aforementioned bug. @section qpn_4_0_04 Version 4.0.04, 2009-04-09 The maintenance release provides a fix for the compile-time assertions, which did not work correctly for the GNU compiler family. Also, the ARM Cortex-M3 examples have been recompiled with the newer IAR EWARM v5.30. This maintenance release does not change the QP-nano API in any way, so the release has NO IMPACT on the QP-nano applications. The main changes in QP v4.0.04 with respect to earlier Version are as follows: - in qassert.h file the #Q_ASSERT_COMPILE macro has been modified to render a negative array dimension when the asserted condition is not TRUE. @section qpn_4_0_03 Version 4.0.03, 2008-08-06 The main purpose of this release is to "future-proof" the QK-nano preemptive kernel. The release 4.0.03 strictly preserves the semantics of QK_currPrio_ variable, which was violated by the previous QK mutex implementation. The mutex locking now uses a different variable QK_ceilingPrio_, which represents the ceiling-priority locked by the mutex. When the mutex is configured (the macro #QK_MUTEX is defined), the QK-nano scheduler performs an additional check to make sure that only tasks with priorities above the ceiling can run. This additional overhead is not present when #QK_MUTEX is not defined. This maintenance release does not change the QP-nano API in any way, so the release has NO IMPACT on the QP-nano applications. The main changes in QP v4.0.03 with respect to earlier Version are as follows: - in qkn.c file, changed priority-ceiling mutex implementation to use the QK_ceilingPrio_ instead of QK_currPrio_. Also added testing priority against the QK_ceilingPrio_, when the macro QK_MUTEX is defined. @section qpn_4_0_02 Version 4.0.02, 2008-08-06 This maintenace release is made to allow posting events from any active object to any active object from the top-most initial transtions. This maintenance release does not change the QP-nano API in any way, so the release has NO IMPACT on the QP-nano applications. The main changes in QP v4.0.02 with respect to earlier Version are as follows: - modified function QF_run() in qfn.c to first loop over all active objects and initialize their priority attribute based on their location in the QF_active[] array. The second for-loop triggers only the initial transitions, but now all priorities are initialized, so active objects can post events to each others from the initial transitions. - modified function QF_run() in qkn.c in identical way as in qfn.c described above. @section qpn_4_0_01 Version 4.0.01, 2008-06-08 This maintenace release is made to allow compiling QP-nano with the GNU compiler for AVR (WinAVR). Specifically, some changes were necessary to accomodate the non-standard way of hanlding constant data objects allocated in ROM (PROGMEM) in the GNU compiler for AVR. This maintenance release does not change the QP-nano API in any way, so the release has NO IMPACT on the QP-nano applications. The main changes in QP v4.0.01 with respect to earlier Version are as follows: - eliminated QF_pCB_ variable from qfn.c and qkn.c. This variable was used to point to the constant active object control block (QActiveCB) in ROM. The GNU compliler for AVR could not handle such pointer correctly without contaminating the code with non-portable and non-standard extensions. - added Doxygen comments to the qep.h header file. - in qepn.c file, broken up expressions of the form if (t == path[iq]) ... into (s = path[iq]; if (t == s) ...). This was done to accommodate the ImageCraft ICCM8C compiler for PSoC. @section qpn_4_0_00 Version 4.0.00, 2008-04-07 This milestone release is made for the book /ref PSiCC2. The book describes in great detail this new release. The older "QP-nano Programmer's Manual" is now phased out and is replaced with this hyper-lirenked /ref main_page "QP-nano Reference Manual", which provides very detailed, easily searchable reference to the software. The book /ref PSiCC2 provies in-depth discussion of the relevant concepts as well as the design study of QP v4.0, including QP-nano v4.0 in Chapter 12. The main changes in QP v4.0 with respect to earlier versions are as follows: - the coding techniques for hierarchical state machines (HSMs) and the simpler finite state machines (FSMs) have changed. While the changes are quite simple, the backward compatibility with QEP-nano 3.x has been broken, meaning that some manual changes to the state machines implemented with earlier versions are necessary. Please refer to the "QP-nano Tutorial" Section /ref coding_hsm for more information about coding state machines with QEP 4.x. - The main change is the signature of a state-handler function, which now returns simply a byte. This return type (typedef'ed as QState) is the status of the event-handling that the state handler conveys to the QEP event processor. - The macro #Q_TRAN() must now always follow the return statement. - The new macro #Q_SUPER() designates the superstate of the given state. Again, this macro must follow the return statement. - Then two new macros #Q_HANDLED() and #Q_IGNORED() have been added to return the status of event handled and event ignored, respectively. - all callback functions are now consistently called /c #XXX_onYYY(): - Q_assert_handler() is now Q_onAssert() - QF_start() is now QF_onStartup() - QF_cleanup() is now QF_onCleanup() - all callback functions are now consistently called /c XXX_onYYY(): - Q_assert_handler() is now Q_onAssert() - QF_start() is now QF_onStartup() - QF_cleanup() is now QF_onCleanup() - enumerating global active object priorities is no longer necessary. - the methods of posting events have changed: - QF_post(prio, sig, par) is now void QActive_post(me, sig, par) - QF_postISR(prio, sig, par) is now void QActive_postISR(me, sig, par) - the global variable QF_activeNum has been eliminated - instead the constant #QF_MAX_ACTIVE must correspond to the exact number of active objects in the application. - the QEP-nano event processor now works identically as the full-Version QEP. Specifically, the signal of the current event is not used to notify the event processor that a transition has taken place. This saves a few bytes of code for every usage of #Q_TRAN(). - all QF-nano and QK-nano functions have been modified to use static variables instead of stack variables wherever possible. This saves a few bytes of stack for the "vanilla" kernel. In QK-nano the savings can be more substantial. - the QP-nano event queues now decrement the head and tail counters. This leads to wrap-around at zero, which is easier (faster) to test than any other wrap-around point. - all examples in the standard QP-nano distribution have been cleaned up and updated to the latest QP-nano API changes. */ Finally, this release improves the comments in the QF_stop() function. The comments now make it very clear that after calling QF_stop() the application must terminate and cannot continue. In particular, QF_stop() is **not** intended to be followed by a call to QF_init() to "resurrect" the application. The previous comments apparently were confusing and some developers attempted to "restart" a running application, which led to system crashes. ================================================ FILE: doxygen/img/img.htm ================================================ QP built-in images ================================================ FILE: doxygen/lint.dox ================================================ /*! @page lint PC-Lint The QP-nano framework comes with extensive support for automatic rule checking by means of PC-Lint, which is designed not just for proving compliance of the Q/CP framework code, but more importantly, to aid in checking compliance of the application-level code. Any organization engaged in designing safety-related embedded software could benefit from the unprecedented quality infrastructure built around the QP-nano framework. @sa ports_lint */ ================================================ FILE: doxygen/macros.h ================================================ /*! * @file * @ingroup qepn qfn qkn qvn * macros for porting QP-nano, and command-line macros */ /*! The preprocessor switch to disable checking assertions */ /** * @description * When defined, Q_NASSERT disables the following macros #Q_ASSERT, * #Q_REQUIRE, #Q_ENSURE, #Q_INVARIANT, #Q_ERROR as well as * #Q_ASSERT_ID, #Q_REQUIRE_ID, #Q_ENSURE_ID, #Q_INVARIANT_ID, and * #Q_ERROR_ID do NOT evaluate the test condition passed as the * argument to these macros. * * @note One notable exception is the macro #Q_ALLEGE, that still * evaluates the test condition, but does not report assertion * failures when the switch #Q_NASSERT is defined. */ #define Q_NASSERT /*! @deprecated macro to enable keeping track of QF time event usage; * instead use: #QF_TIMEEVT_USAGE */ #define Q_TIMERSET /*! This macro enables calling the QK-nano context-switch callback * QK_onContextSw() */ #define QK_ON_CONTEXT_SW /*! Macro that should be defined (typically on the compiler's command line) in the Win32-GUI applications that use the @ref win32-qv port. */ #define WIN32_GUI ================================================ FILE: doxygen/main.dox ================================================ /*! @mainpage About QP-nano™ @image html qpn_banner.jpg @section ab_new What's new? To check what's new in QP-nano, please see @ref history "QP-nano Revision History". @attention The QP-nano framework is being __phased out__ and is not recommended for new product development. @section ab_about What is it? QP-nano™ (Quantum Platform Nano) is an ultra-lightweight Real-Time Embedded Framework (RTEF) for building responsive and modular real-time embedded applications as systems of asynchronous event-driven active objects (concurrent @ref sm "state machines"). The QP-nano™ RTEF is a member of a larger family consisting of QP-nano, QP/C, and QP/C++ frameworks, which are all strictly quality controlled, thoroughly documented, and available under @ref licensing "dual licensing model". @note The QP-nano™ framework is intended for **low-end** 8- and 16-bit microcontrollers such as AVRmega, MSP430, or 8051 with very limited RAM on board (less then 1KB). If your MCU has more than 1KB of RAM, you should consider the QP/C™ framework instead of QP-nano™. @attention To use QP-nano™ effectively, you need to understand the key concepts that underline the architecture of the framework and your applications based on the framework.
@htmlonly @endhtmlonly @section ab_goals What does it do? The main goals of the QP-nano™ framework are: - to provide a reusable **architecture** based on active objects (actors), which is _safer_ and more extensible than the venerable "superloop" commonly used on low-end 8- and 16-bit microcontrollers. - to provide a simple-to-use coding techniques for @ref sm "hierarchical state machines", with which to implement the behavior of active objects. - to provide efficient and thread-safe event-driven mechanisms for active objects to communicate, such as direct event passing. - to provide event-driven timing services (time events). - to provide a selection of built-in real-time kernels to run the QP applications, such as the cooperative @ref qvn "QV-nano kernel" and the preemptive non-blocking @ref qkn "QK-nano kernel". - to provide portability layer and ready-to-use emulations on the desktop operating systems such as @ref posix-qv "Linux" and @ref win32-qv "Windows". - to provide a target for modeling and automatic code generation from the QM modeling tool. @section ab_special What's special about it? The QP-nano™ Real-Time Embedded Framework (RTEF) is a unique offering on the embedded software market. It provides a modern, reusable **architecture** of embedded applications, which combines object-orientation with the particular model of concurrency, known as active objects (concurrent @ref sm "state machines"). This architecture is generally **safer** and better structured than the venerable "superloop + spaghetti-code" commonly used on low-end 8- and 16-bit microcontrollers. @subsection lightweight Ultra-Lightweight The most unique characteristic of the QP-nano™ framework is its **tiny footprint**, especially in RAM. In this respect, QP-nano™ requires far less resources than even the smallest conventional Real-Time Operating System (RTOS) kernel. In fact, it has been designed to run on microcontrollers, where you cannot fit any traditional kernel. At the same time, QP-nano™ gives you a much higher level of abstraction than a conventional RTOS. With QP-nano™, you work at the level of active objects, state machines and events, as opposed to "superloop" commonly used on low-end 8- and 16-bit microcontrollers. @note If you can program your MCU in ANSI-C, you probably can fit in QP-nano™. For example, the article UML Statecharts at $10.99 describes a complete QP-nano™ application (PEdestrian LIght CONtroled (PELICAN) crossing) implemented in a 8051 MCU with 256 bytes of RAM. @subsection oop Object Orientation Even though it is written in @ref misra "MISRA-compliant" ANSI-C, QP-nano™ is fundamentally an **object-oriented** framework, which means that the framework itself and your applications derived from the framework are fundamentally composed of classes and only classes can have @ref sm "state machines" associated with them.
@note If you program in C and object-oriented programming is new to you, please refer to the Application Note "Object-Oriented Programming in C", which describes how you can implement the concepts of _classes_, _inheritance_, and _polymorphism_ to portable ANSI-C.
@htmlonly
Application Note: Object-Oriented Programming in C
@endhtmlonly @subsection hsms Hierarchical State Machines The behavior of active objects is specified in QP-nano™ by means of hierarchical state machines (UML statecharts). The frameworks support manual coding of UML state machines in C or C++ as well as fully automatic code generation by means of the free graphical QM™ modeling tool. @remarks State machines can be an incredibly powerful technique, but they require an event-driven **infrastructure** (framework) that provides, at a minimum: a run-to-completion (RTC) execution context for each state machine, queuing of events, and event-based timing services. This is really the pivotal point. Without an event-driven framewok (like QP-nano), state machines are like cars without an infrastructure of roads. @subsection kernels Built-in Kernels All QP-nano™ framework is designed to run on @ref exa_native "low-end 8- and 16-bit single-chip microcontrollers", replacing the venerable "superloop". The framework contains two built-in real-time kernels: the cooperative @ref qvn "QV-nano kernel" and the _preemptive_ non-blocking @ref qkn "QK-nano kernel". @ref ports_native "Native QP ports" and ready-to-use @ref exa_native "examples" are provided for selected @ref exa_ref_mcu "CPU families". @subsection emul Windows/Linux Emulation QP-nano™ can also be emulated on @ref ports_os "desktop OSes" (such as Windows and Linux), which allows you to develop and test large portions of your deeply embedded code on the desktop. @subsection popular Popularity & Maturity With over 15 years of continuous development and 60,000 downloads a year, the QP™ RTEF family is the most mature and popular such solution on the embedded software market. The QP™ frameworks are used in millions of products worldwide in aerospace, medical devices, consumer electronics, wired and wireless telecommunications, industrial automation, transportation, robotics, and many more. @subsection psicc2 Book The book, Practical UML Statecharts in C/C++, 2nd Edition provides a detailed design study of the QP frameworks and explains all the related concepts. @image html PSiCC2-3D.jpg "Practical UML Statecharts in C/C++, 2nd Edition" @section licensing How is it licensed? QP-nano™ is licensed under the increasingly popular dual licensing model, in which both the open source software distribution mechanism and traditional closed source software distribution models are combined. @note If your company has a policy forbidding open source in your product, all QP frameworks can be licensed commercially, in which case you don't use any open source license and you do not violate your policy. @subsection open-source Open Source Projects If you are developing and distributing open source applications under the GNU General Public License (GPL), as published by the Free Software Foundation, then you are free to use the Quantum Leaps software under the GPL version 3 of the License, or (at your option) any later version. Please note that GPL requires that all modifications to the original code as well as your application code (Derivative Works as defined in the Copyright Law) must also be released under the terms of the GPL open source license. @subsection closed-source Closed Source Projects If you are developing and distributing traditional closed source applications, you can purchase one of Quantum Leaps commercial licenses, which are specifically designed for users interested in retaining the proprietary status of their code. All Quantum Leaps commercial licenses expressly supersede the GPL open source license. This means that when you license Quantum Leaps software under a commercial license, you specifically do not use the software under the open source license and therefore you are not subject to any of its terms. @section support How to get help? Please post any **technical questions** to the Free Support Forum hosted on SourceForge.net. Posts to this forum benefit the whole community and are typically answered the same day. Direct **Commercial Support** is available to the commercial licensees. Every commercial license includes one year of Technical Support for the licensed software. The support term can be extended annually. Training and consulting services are also available from Quantum Leaps. Please refer to the Contact web-page for more information. @section contact Contact Information - Quantum Leaps Web site: state-machine.com - Quantum Leaps licensing: state-machine.com/licensing - QP/QM on SourceForge.net: sourceforge.net/projects/qpc - QP/QM on GitHub: github.com/QuantumLeaps - e-mail: info@state-machine.com @image html logo_ql_TM.jpg @next{gs} */ ================================================ FILE: doxygen/make.bat ================================================ @echo off :: ========================================================================== :: Product: batch script for generating Doxygen documentation :: Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved. :: :: SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial :: :: This software is dual-licensed under the terms of the open source GNU :: General Public License version 3 (or any later version), or alternatively, :: under the terms of one of the closed source Quantum Leaps commercial :: licenses. :: :: The terms of the open source GNU General Public License version 3 :: can be found at: :: :: The terms of the closed source Quantum Leaps commercial licenses :: can be found at: :: :: Redistributions in source code must retain this top-level comment block. :: Plagiarizing this software to sidestep the license obligations is illegal. :: :: Contact information: :: :: :: ========================================================================== @setlocal @echo usage: @echo make @echo make -CHM @echo make ... :: Doxygen tool (adjust to your system) ...................................... @set DOXYGEN=doxygen :: HTML Help tool (needed only with the -CHM option, (adjust to your system) . @set HHC="C:\tools\HTML Help Workshop\hhc.exe" :: Simple complexity metrics tool (adjust to your system) ................... @set LIZARD=lizard :: Generate metrics.dox file... @set METRICS_INP=..\include ..\src -x ..\src\qs\* @set METRICS_OUT=metrics.dox @echo /** @page metrics Code Metrics > %METRICS_OUT% @echo.>> %METRICS_OUT% @echo @code{cpp} >> %METRICS_OUT% @echo Code Metrics for QP-nano >> %METRICS_OUT% %LIZARD% -m -L500 -a10 -C20 -V %METRICS_INP% >> %METRICS_OUT% @echo @endcode >> %METRICS_OUT% @echo */ >> %METRICS_OUT% :: Generate Doxygen Documentation... if "%1"=="-CHM" ( @echo Generating HTML... %DOXYGEN% Doxyfile-CHM @echo Adding custom images... xcopy preview.js tmp\ xcopy img tmp\img\ @echo img\img.htm >> tmp\index.hhp @echo Generating CHM... %HHC% tmp\index.hhp @echo. @echo Cleanup... @rmdir /S /Q tmp @echo CHM file generated ) else ( @echo. @echo Cleanup... rmdir /S /Q ..\html @echo Adding custom images... xcopy preview.js ..\html\ xcopy img ..\html\img\ copy images\favicon.ico ..\html @echo Generating HTML... %DOXYGEN% Doxyfile%1 @qclean ..\html ) @endlocal ================================================ FILE: doxygen/modules.dox ================================================ /*! @defgroup qepn QEP-nano @brief Hierarchical Event Processor QEP-nano is a universal, UML-compliant event processor that enables developers to code UML state machines in highly readable ANSI-C, in which every state machine element is mapped to code precisely, unambiguously, and exactly once (traceability). QEP fully supports hierarchical state nesting, which is the fundamental mechanism for reusing behavior across many states instead of repeating the same actions and transitions over and over again. */ /*! @defgroup qfn QF-nano @brief Active Object (Actor) Framework QF-nano is a portable, event-driven, real-time framework for execution of active objects (concurrent state machines) specifically designed for real-time embedded (RTE) systems. */ /*! @defgroup qkn QK-nano @brief Preemptive Non-Blocking Kernel QK is a tiny **preemptive**, priority-based, non-blocking kernel designed specifically for executing active objects. QK meets all the requirement of the Rate Monotonic Scheduling (a.k.a. Rate Monotonic Analysis — RMA) and can be used in hard real-time systems. */ /*! @defgroup qvn QV-nano @brief Cooperative Run-to-Completion Kernel QV-nano is a simple **cooperative** kernel (previously called "Vanilla" kernel). This kernel executes active objects one at a time, with priority-based scheduling performed before processing of each event. Due to naturally short duration of event processing in state machines, the simple QV kernel is often adequate for many real-time systems. */ /*! @dir ../include Platform-independent QP-nano API @note The QP-nano include directory needs to be added to the compiler's include path in the applications using QP-nano. */ /*! @dir ../source Platform-independent QP-nano implementation Files from this directory need to be added to the project, to build the QP-nano framework from source code. @attention Not all QP-nano source files should be added to every project. For example, QP-nano ports to the preemptive QK-nano kernel should **not** contain the file qvn.c and conversely, QP-nano ports to the cooperative QV-nano kernel should not contain the files qkn.c. @note The QP-nano source directory needs to be added to the compiler's include path in the applications using QP-nano, because QP-nano is built from sources. */ ================================================ FILE: doxygen/ports.dox ================================================ /*! @page ports Ports @section ports_gen General Comments The QP-nano framework can be easily adapted to various operating systems, processor architectures, and compilers. Adapting the QP-nano software is called porting and the QP-nano framework has been designed from the ground up to make porting easy. The QP-nano distribution contains many QP-nano ports, which are organized into the three categories: - @subpage ports_native "Native Ports" adapt QP-nano to run on bare-metal processors "natively", using one of the built-in kernels (@ref comp_qv "QV" or @ref comp_qk "QK") - @subpage ports_os "3rd-Party OS Ports" adapt QP-nano to run on top of a 3rd-Party Operating System (OS), such as Windows or Linux. @section ports_code Port Code Structure Starting with QP-nano release 5.4.0, **all** available ports are bundled into the QP-nano download, as opposed to being distributed as separate QP Development Kits (QDKs). The main benefit is of this approach is that it greatly reduces chances of mistakes in combining the mainline QP-nano code with various QDKs. The downside is that the QP-nano distribution becomes quite large and that ports cannot be added or updated independently from the QP-nano baseline code. All ports are located in sub-directories of the ports @ref qpn_files "top-level folder", with the hierarchical organization outlined below:
  • ports
    • arm-cm — Native ports for ARM-Cortex-M (bare-metal) A
      • qk — Port to the @ref comp_qk "preemptive QK kernel"
        • arm — Port to ARM-KEIL toolset
          • dbg — Debug @ref exa_sec_conf "build configuration"
          • rel — Release build configuration
          • spy — Spy build configuration
        • gnu — Port to GNU toolset
        • iar — Port to IAR toolset
      • qv — Port to the @ref comp_qv "cooperative QV kernel"
        • arm — Port to ARM-KEIL toolset
          • dbg — Debug @ref exa_sec_conf "build configuration"
          • rel — Release build configuration
          • spy — Spy build configuration
        • gnu — Port to GNU toolset
        • iar — Port to IAR toolset
    • win32-qv — Port to Win32-QV (Windows) B
    • posix-qv — Port to POSIX-QV (Linux, BSD, etc.) B
  • A **Native Ports** are located in sub-directories named after the CPU architecture, such as arm-cm for ARM Cortex-M. Under that directory, the sub-directories qk and qv contain ports for the @ref comp_qk "QK" and @ref comp_qv "QV" kernels, respectively.
  • B **Ports for 3rd-party OS** are located in sub-directories named after the OS, such as win32-qv for the Win32-QV (Windows with QV-type scheduler).
@note Because the QP distribution contains *all* ports, the number of sub-directories and files in the ports folder may seem daunting. However, knowing the structure of the ports folder, you can simply **delete** the sub-directories that are not interesting to you. @next{ports_native} */ ================================================ FILE: doxygen/ports_arm-cm.dox ================================================ /*##########################################################################*/ /*! @page arm-cm ARM Cortex-M @tableofcontents

This section describes the QP-nano™ port to the ARM Cortex-M processor family (Cortex M0/M0+/M3/M4). Three main implementation options are covered: the @subpage arm-cm_qv "cooperative, priority-based QV-nano kernel" and the @subpage arm-cm_qk "preemptive run-to-completion QK-nano kernel". Additionally, the use of the VFP (floating point coprocessor) in the M4F processor is explained as well. This document assumes QP-nano version 5.9.x or higher.

@note To focus the discussion, this section references the **GNU-ARM toolchain**. However, the general implementation strategy applies equally to all toolchains for ARM Cortex-M, such as **ARM-KEIL** and **IAR EWARM**, which are all provided as well. The QP code downloads contain also examples for other boards, such as STM32 Nucleo, NXP mbed-1768, SilLabs Gecko and others. @section arm-cm_files Directories and Files The QP ports to ARM Cortex-M are available in the standard QP distribution. Specifically, the ARM Cortex-M ports are placed in the following directories:
  • /pors/arm-cm/
    • qv/ — QV ports
      • arm/ — ARM-KEIL toolchain
      • gnu/ — GNU-ARM toolchain
        • qfn_port.h — QF-nano port header
        • qvn_port.c — QV-nano port implementation
      • iar/ — IAR-EWARM toolchain
    • qk/ — QK-nano ports
      • arm/ — ARM-KEIL toolchain
      • armclang/ — ARM-KEIL toolchain CLANG/LLVM compiler
      • gnu/ — GNU-ARM toolchain
      • iar/ — IAR-EWARM toolchain
@section arm-cm_int Interrupts in the QP-nano Ports to ARM Cortex-M The QP-nano framework, like any real-time kernel, needs to disable interrupts in order to access critical sections of code and re-enable interrupts when done. This section describes the general policy that in the ARM Cortex-M ports of all built-in real time kernels in QP, such as QV-nano and QK-nano. @subsection arm-cm_kernel-aware "Kernel-Aware" and "Kernel-Unaware" Interrupts The QP ports to ARM Cortex-M3/M4 **never completely disables interrupts**, even inside the critical sections. On Cortex-M3/M4 (ARMv7-M architecture), the QP port disables interrupts **selectively** using the BASEPRI register. This policy divides interrupts into "kernel-unaware" interrupts, which are never disabled, and "kernel-aware" interrupts, which are disabled in the QP critical sections. @note The BASEPRI register is not implemented in the ARMv6-M architecture (Cortex-M0/M0+), so Cortex-M0/M0+ need to use the PRIMASK register to disable interrupts globally. In other words, in Cortex-M0/M0+ ports, all interrupts are "kernel-aware". @attention Only "kernel-aware" interrupts are allowed to call QP services. "Kernel-unaware" interrupts are not allowed to call any QP services and they can communicate with QP only by triggering a "kernel-aware" interrupt (which can post or publish events). As illustrated in the figures below, the number of interrupt priority bits actually available is implementation dependent, meaning that the various ARM Cortex-M silicon vendors can provide different number of priority bits, varying from just 3 bits (which is the minimum for ARMv7-M architecture) up to 8 bits. For example, the TI Tiva-C microcontrollers implement only 3 priority bits (see figure below). @image html arm-cm_int3bit.png "Kernel-aware and Kernel-unaware interrupts with 3 priority bits On the other hand, the STM32 MCUs implement 4 priority bits (see figure below). The CMSIS standard provides the macro __NVIC_PRIO_BITS, which specifies the number of NVIC priority bits defined in a given ARM Cortex-M implementation. @image html arm-cm_int4bit.png "Kernel-aware and Kernel-unaware interrupts with 4 priority bits Another important fact to note is that the ARM Cortex-M core stores the interrupt priority values in the *most significant bits* of its eight bit interrupt priority registers inside the NVIC (Nested Vectored Interrupt Controller). For example, if an implementation of a ARM Cortex-M microcontroller only implements three priority bits, then these three bits are shifted to occupy bits five, six and seven respectively. The unimplemented bits can be written as zero or one and always read as zero. And finally, the NVIC uses an inverted priority numbering scheme for interrupts, in which priority zero (0) is the highest possible priority (highest urgency) and larger priority numbers denote actually lower-priority interrupts. So for example, interrupt of priority 2 can preempt an interrupt with priority 3, but interrupt of priority 3 cannot preempt interrupt of priority 3. The default value of priority of all interrupts out of reset is zero (0). @note Starting with QP 5.9.x, the QF_init() call sets interrupt priority of all IRQs to the "kernel aware" value QF_BASEPRI. Still, it is highly recommended to set the priority of all interrupts used by an application **explicitly**. @attention Some 3rd-party libraries (e.g., STM32Cube) change the interrupt priorities and sometimes priority grouping internally and unexpectedly, so care must be taken to change the priorities back to the appropriate values right before running the application. The CMSIS provides the function @c NVIC_SetPriority() which you should use to set priority of every interrupt. @note The priority scheme passed to `NVIC_SetPriority()` is different again than the values stored in the NVIC registers, as shown in the figures above as "CMSIS priorities" @subsection arm-cm_int-assign Assigning Interrupt Priorities The @ref exa_arm-cm "example projects" included in the QP distribution the recommended way of assigning interrupt priorities in your applications. The initialization consist of two steps: (1) you enumerate the "kernel-unaware" and "kernel-aware" interrupt priorities, and (2) you assign the priorities by calling the @c NVIC_SetPriority() CMSIS function. The following snippet of code illustrates these steps with the explanation section following immediately after the code. @anchor arm-cm_int-assign-code Listing: Assigning the interrupt priorities (see file bsp.c in the example projects) @code{c} /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ [1] enum KernelUnawareISRs { /* see NOTE0 */ /* ... */ [2] MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ [3] Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); [4] enum KernelAwareISRs { [5] GPIOPORTA_PRI = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ [6] MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ [7] Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF>>(8-__NVIC_PRIO_BITS))); ~ ~ ~ [8] void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(ROM_SysCtlClockGet() / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ [9] NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ [10] NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); [11] NVIC_SetPriority(GPIOPortA_IRQn, GPIOPORTA_PRIO); ~ ~ ~ /* enable IRQs... */ [12] NVIC_EnableIRQ(GPIOPortA_IRQn); } @endcode
  • 1 The enumeration @c KernelUnawareISRs lists the priority numbers for the "kernel-unaware" interrupts. These priorities start with zero (highest possible). The priorities are suitable as the argument for the @c NVC_SetPriority() CMSIS function. > NOTE: The NVIC allows you to assign the same priority level to multiple interrupts, so you can have more ISRs than priority levels running as "kernel-unaware" or "kernel-aware" interrupts.
  • 2 The last value in the enumeration MAX_KERNEL_UNAWARE_CMSIS_PRI keeps track of the maximum priority used for a "kernel-unaware" interrupt.
  • 3 The compile-time assertion ensures that the "kernel-unaware" interrupt priorities do not overlap the "kernel-aware" interrupts, which start at QF_AWARE_ISR_CMSIS_PRI.
  • 4 The enumeration KernelAwareISRs lists the priority numbers for the "kernel-aware" interrupts.
  • 5 The "kernel-aware" interrupt priorities start with the QF_AWARE_ISR_CMSIS_PRI offset, which is provided in the qf_port.h header file.
  • 6 The last value in the enumeration MAX_KERNEL_AWARE_CMSIS_PRI keeps track of the maximum priority used for a "kernel-aware" interrupt.
  • 7 The compile-time assertion ensures that the "kernel-aware" interrupt priorities do not overlap the lowest priority level reserved for the PendSV exception.
  • 8 The QF_onStartup() callback function is where you set up the interrupts.
  • 9 This call to the CMIS function @c NVIC_SetPriorityGrouping() assigns all the priority bits to be preempt priority bits, leaving no priority bits as subpriority bits to preserve the direct relationship between the interrupt priorities and the ISR preemption rules. This is the default configuration out of reset for the ARM Cortex-M3/M4 cores, but it can be changed by some vendor-supplied startup code. To avoid any surprises, the call to NVIC_SetPriorityGrouping(0U) is recommended.
  • 10-11 The interrupt priories fall all interrupts ("kernel-unaware" and "kernel-aware" alike) are set explicitly by calls to the CMSIS function @c NVIC_SetPriority().
  • 12 All used IRQ interrupts need to be explicitly enabled by calling the CMSIS function.
@subsection arm-cm_int-fpu Interrupts and the FPU (Cortex-M4F) The QP ports described in this section support also the ARM Cortex-M4F. Compared to all other members of the Cortex-M family, these cores includes the single precision variant of the ARMv7-M Floating-Point Unit (Fpv4-SP). The hardware FPU implementation adds an extra floating-point register bank consisting of S0-S31 and some other FPU registers. This FPU register set represents additional context that need to be preserved across interrupts and thread switching (e.g., in the preemptive QK-nano kernel). The ARM VFP has a very interesting feature called **lazy stacking** [@ref ARM-AN298]. This feature avoids an increase of interrupt latency by skipping the stacking of floating-point registers, if not required, that is: - if the interrupt handler does not use the FPU, or - if the interrupted program does not use the FPU. If the interrupt handler has to use the FPU and the interrupted context has also previously used by the FPU, then the stacking of floating-point registers takes place at the point in the program where the interrupt handler first uses the FPU. The lazy stacking feature is programmable and by default it is turned ON. @note All built-in kernels in QP are designed to take advantage of the lazy stacking feature [@ref ARM-AN298]. @section arm-cm_ref References @anchor ARM-AN298 - **[ARM AN298]** ARM Application Note 298 "Cortex-M4(F) Lazy Stacking and Context Switching", ARM 2012 @anchor ARM-EPM-064408 - **[ARM-EPM-064408]** "ARM Processor Cortex-M7 (AT610) and Cortex-M7 with FPU (AT611) Software Developers Errata Notice" @anchor Reminder - **[Reminder]** "Reminder State Pattern" @next{arm-cm_qv} */ /*##########################################################################*/ /*! @page arm-cm_qv Cooperative QV-nano Kernel @tableofcontents

The non-preemptive, cooperative QV-nano kernel executes active objects one at a time, with priority-based scheduling performed after run-to-completion (RTC) processing of each event. Due to naturally short duration of event processing in state machines, the simple QV-nano kernel is often adequate for many real-time systems.

@remarks In the QV-nano port, the only components requiring platform-specific porting are QF-nano and QV-nano itself. The other two components: QEP and QS require merely recompilation and will not be discussed here. With the QV-nano port you're not using the QK-nano kernel. The QV-nano port to ARM Cortex-M is located in the folder /ports/arm-cm/qv/. @section arm-cm_qv-synopsis Synopsis of the QV-nano Port on ARM Cortex-M The cooperative QV-nano kernel works essentially as the traditional foreground-background system (a.k.a. "superloop") in that all active objects are executed in the main loop and interrupts always return back to the point of preemption. To avoid race conditions between the main loop and the interrupts, QV briefly disables interrupts. 1. The ARM Cortex-M processor executes application code (the main loop) in the Privileged Thread mode, which is exactly the mode entered out of reset. 2. The exceptions (including all interrupts) are always processed in the Privileged Handler mode. 3. QV-nano uses only the Main Stack Pointer. The Process Stack Pointer is not used and is not initialized. 4. ARM Cortex-M enters interrupt context without disabling interrupts (without setting the PRIMASK bit or the BASEPRI register). Generally, you should not disable interrupts inside your ISRs. In particular, the QP services QF_tickXISR(), QACTIVE_POST_ISR() should be called with **interrupts enabled**, to avoid nesting of critical sections. > NOTE: If you don't wish an interrupt to be preempted by another interrupt, you can always prioritize that interrupt in the NVIC to a higher level (use a lower numerical value of priority). 5. The `QF_init()` function calls the function `QV_init()` to set the interrupt priority of all IRQs available in the MCU to the safe value of @ref QF_BASEPRI "QF_BASEPRI" (for ARM-v7 architecture). @section arm-cm_qv-qf_port The qf_port.h Header File The QF header file for the ARM Cortex-M port is located in `/ports/arm-cm/qv/gnu/qf_port.h`. This file specifies the interrupt disabling policy (QF critical section) as well as the configuration constants for QF (see Chapter 8 in [PSiCC2]). @note The ARM Cortex-M allows you to use the simplest "unconditional interrupt disabling" policy (see Section 7.3.2 in [PSiCC2]), because ARM Cortex-M is equipped with the standard nested vectored interrupt controller (NVIC) and generally runs ISRs with interrupts enabled (so the body of an ISR is not a critical section). The following listing shows the `qfn_port.h` header file for ARM Cortex-M with the GNU-ARM toolchain. Other toolchains use slightly different conditional compilation macros to select the Cortex-M variants, but implement the same policies. @anchor arm-cm_qf_port_h-code Listing: The qfn_port.h header file for ARM Cortex-M @code{c} /* QF interrupt disable/enable and log2()... */ [1] if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ [2] #define QF_INT_DISABLE() __asm volatile ("cpsid i") [3] #define QF_INT_ENABLE() __asm volatile ("cpsie i") /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ [4] #define QF_AWARE_ISR_CMSIS_PRI 0 /* macro to put the CPU to sleep inside QV_onIdle() */ [5] #define QV_CPU_SLEEP() do { \ [6] __asm volatile ("wfi"); \ [7] QF_INT_ENABLE(); \ } while (0) [8] #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ [9] #define QF_PRIMASK_DISABLE() __asm volatile ("cpsid i") [10] #define QF_PRIMASK_ENABLE() __asm volatile ("cpsie i") /* Cortex-M3/M4 interrupt disabling policy */ [11] #define QF_INT_DISABLE() QF_SET_BASEPRI(QF_BASEPRI) [12] #define QF_INT_ENABLE() QF_SET_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ [13] #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ [14] #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* macro to put the CPU to sleep inside QV_onIdle() */ [15] #define QV_CPU_SLEEP() do { \ [16] QF_PRIMASK_DISABLE(); \ [17] QF_INT_ENABLE(); \ [18] __asm volatile ("wfi"); \ [19] QF_PRIMASK_ENABLE(); \ } while (0) /* macro for setting the BASEPRI register */ [20] #define QF_SET_BASEPRI(basepri_) __asm volatile (\ "msr BASEPRI,%0" :: "r" (basepri_) : ) /* initialization of the QV kernel for Cortex-M3/M4/M7 */ [21] #define QV_INIT() QV_init() void QV_init(void); #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ [22] #define QF_ISR_NEST [23] #include /* Exact-width types. WG14/N843 C99 Standard */ [24] #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel interface */ @endcode
  • 3 As described in the previous @ref arm-cm_int "Section", the interrupt disabling policy for the ARMv6-M architecture (Cortex-M0/M0+) is different than the policy for the ARMv7-M. In GNU-ARM, the macro `__ARM_ARCH` is defined as 6 for the ARMv6-M architecture (Cortex-M0/M0+), and 7 for ARMv7-M (Cortex-M3/M4/M4F). > NOTE: The `__ARM_ARCH` macro is specific to the GNU-ARM compiler. Other compilers for ARM Cortex-M provide different macros to detect the CPU type.
  • 4-5 For the ARMv6-M architecture, the interrupt disabling policy uses the PRIMASK register to disable interrupts globally. The @c QF_INT_DISABLE() macro resolves in this case to the inline assembly instruction "CPSD i", which sets the PRIMASK. The @c QF_INT_ENABLE() macro resolves to the inline assembly instruction "CPSE i", which clears the PRIMASK.
  • 6 The #QF_CRIT_STAT_TYPE is NOT defined, meaning that the critical section uses the simple policy of "unconditional interrupt disablin". > NOTE: The "unconditional interrupt disabling" policy precludes nesting of critical sections, but this is not needed for ARM Cortex-M, because this CPU never disables interrupts, even when handling exceptions/interrupts.
  • 7 The QF_CRIT_ENTRY() enters a critical section. Interrupts are disabled by setting the PRIMASK register.
  • 8 The QF_CRIT_EXIT() macro leaves the critical section. Interrupts are unconditionally re-enabled by clearing the PRIMASK register.
  • 9 For the ARMv6-M architecture, the `QF_AWARE_ISR_CMSIS_PRI` priority level is defined as zero, meaning that all interrupts are "kernel-aware", because all interrupt priorities are disabled by the kernel.
  • 10 The `QF_LOG2()` macro is defined as a call to the function `QF_qlog2()` ("quick log-base-2 logarithm"). This function is coded in hand-optimized assembly, which always takes only 14 CPU cycles to execute (see also label [23]). > NOTE: ARM Cortex-M0/M0+ does NOT implement the `CLZ` instruction. Therefore the log-base-2 calculation cannot be accelerated in hardware, as it is for ARM Cortex-M3 and higher.
  • 11 For the ARMv7-M (Cortex-M3/M4/M4F) architecture...
  • 12 The `QF_PRIMASK_DISABLE()` macro resolves to the inline assembly instruction `CPSD i`, which sets the PRIMASK.
  • 13 The `QF_PRIMASK_ENABLE()` macro resolves to the inline assembly instruction `CPSE i`, which clears the PRIMASK.
  • 14 Interrupts are disabled by setting the BASEPRI register to the value defined in the `QF_BASEPRI` macro (see label [19]). This setting of the BASEPRI instruction `msr BASEPRI,...` is surrounded by setting and clearing the PRIMASK register, as a workaround a hardware problem in ARM Cortex-M7 core r0p1: > NOTE: The selective disabling of "QF-aware" interrupts with the BASEPRI register has a problem on ARM Cortex-M7 core r0p1 (see [@ref ARM-EPM-064408], Erratum 837070). The workaround recommended by ARM is to surround `MSR BASEPRI,...` with the `CPSID i`/`CPSIE i` pair, which is implemented in the QF_INT_DISABLE() macro. This workaround works also for Cortex-M3/M4 cores.
  • 15 The `QF_INT_ENABLE()` macro sets the BASEPRI register to zero, which disables BASEPRI interrupt masking. > NOTE: this method can never disable interrupt of priority 0 (highest).
  • 16 The #QF_CRIT_STAT_TYPE is NOT defined, meaning that the critical section uses the simple policy of "unconditional interrupt disabling". > NOTE: The "unconditional interrupt disabling" policy precludes nesting of critical sections, but this is not needed for ARM Cortex-M, because this CPU never disables interrupts, even when handling exceptions/interrupts.
  • 17 The QF_CRIT_ENTRY() enters a critical section. Interrupts are disabled with the macro `QF_INT_DISABLE()` defined at label [12].
  • 18 The QF_CRIT_EXIT() macro leaves the critical section. Interrupts are unconditionally re-enabled with the macro `QF_INT_ENABLE()` defined at label [13].
  • 19 @anchor QF_BASEPRI The `QF_BASEPRI` value is defined such that it is the lowest priority for the minimum number of 3 priority-bits that the ARM7-M architecture must provide. This partitions the interrupts as "kernel-unaware" and "kernel-aware" interrupts, as shown in section @ref arm-cm_int-assign.
  • 20 For the ARMv7-M architecture, the `QF_AWARE_ISR_CMSIS_PRI` priority level suitable for the CMSIS function `NVIC_SetPriority()` is determined by the `QF_BASEPRI` value.
  • 21 The macro `QF_LOG2()` is defined to take advantage of the CLZ instruction (Count Leading Zeroes), which is available in the ARMv7-M architecture. > NOTE: The `__builtin_cls()` intrinsic function is specific to the GNU-ARM compiler. Other compilers for ARM Cortex-M use different function names for this intrinsic function.
  • 22 The macro @c QF_CRIT_EXIT_NOP() provides the protection against merging two critical sections occurring back-to-back in the QP code.
  • 23 For ARMv6 architecture, the prototype of the quick, hand-optimized log-base-2 function is provided (see also label [10]).
@section arm-cm_qv_port_h The qv_port.h Header File The QV header file for the ARM Cortex-M port is located in /ports/arm-cm/qv/gnu/qv_port.h. This file provides the macro QV_CPU_SLEEP(), which specifies how to enter the CPU sleep mode safely in the cooperative QV kernel (see also Section 4.7) and [Samek 07]). @note To avoid race conditions between interrupts waking up active objects and going to sleep, the cooperative QV kernel calls the QV_CPU_SLEEP() callback with interrupts disabled. @anchor arm-cm_qv_port_h-code Listing: The qv_port.h header file for ARM Cortex-M @code{c} #ifdef ARM_ARCH_V6M /* Cortex-M0/M0+/M1 ? */ [1] #define QV_CPU_SLEEP() do { \ __asm volatile ("wfi"); \ QF_INT_ENABLE(); \ } while (0) #else /* Cortex-M3/M4/M4F */ [2] #define QV_CPU_SLEEP() do { \ QF_PRIMASK_DISABLE(); \ QF_INT_ENABLE(); \ __asm volatile ("wfi"); \ QF_RIMASK_ENABLE(); \ } while (0) #endif [3] #define QV_INIT() QV_init() void QV_init(); #include "qv.h" /* QV platform-independent public interface */ @endcode
  • 1 For the ARMv6-M architecture, the macro `QV_CPU_SLEEP()` stops the CPU with the WFI instruction (Wait For Interrupt). After the CPU is woken up by an interrupt, interrupts are re-enabled with the PRIMASK.
  • 2 For the ARMv7-M architecture, the macro `QV_CPU_SLEEP()` first disables interrupts by setting the PRIMASK, then clears the BASEPRI to enable all "kernel-aware" interrupts and only then stops the CPU with the WFI instruction (Wait For Interrupt). After the CPU is woken up by an interrupt, interrupts are re-enabled with the PRIMASK. This sequence is necessary, because the ARM Cortex-M3/M4/M7 cores cannot be woken up by any interrupt blocked by the BASEPRI register.
  • 2 The macro `QV_INIT()` is defined as a call to the `QV_init()` function, which means that this function will be called from `QF_init()`. The `QV_init()` function initializes all available IRQ priorities in the MCU to the safe value of @ref QF_BASEPRI "QF_BASEPRI".
@section arm-cm_qv_port_c The qv_port.c Implementation File The QV implementation file for the ARM Cortex-M port is located in /ports/arm-cm/qv/gnu/qf_port.c. This file defines the function @c QV_init(), which for the ARMv7-M architecture sets the interrupt priorities of all IRQs to the safe value `QF_BASEPRI`. @anchor arm-cm_qv_port_c-code Listing: The qv_port.c header file for ARM Cortex-M @code{c} #include "qf_port.h" [1] #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1 ? */ #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) void QV_init(void) { uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ [2] SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ [3] SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ [4] SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ [5] n = 8 + (*SCnSCB_ICTR << 3); /* # interrupt priority registers */ do { --n; [6] NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); } #endif /* NOT Cortex-M0/M0+/M1 */ @endcode
  • 1 For the ARMv7-M architecture (Cortex-M3/M4)...
  • 2 The exception priorities for User-Fault, Bus-Fault, and Mem-Fault are set to the value QF_BASEPRI.
  • 3 The exception priority for SVCCall is set to the value QF_BASEPRI.
  • 4 The exception priority for SysTick, PendSV, and Debug is set to the value QF_BASEPRI.
  • 5 The number of implemented IRQs is read from the @c SCnSCB_ICTR register
  • 6 The interrupt priority of all implemented IRQs is set to the safe value QF_BASEPRI in a loop.
@section arm-cm_qv-isr Writing ISRs for QV The ARM Cortex-M CPU is designed to use regular C functions as exception and interrupt service routines (ISRs). @note The ARM EABI (Embedded Application Binary Interface) requires the stack be 8-byte aligned, whereas some compilers guarantee only 4-byte alignment. For that reason, some compilers (e.g., GNU-ARM) provide a way to designate ISR functions as interrupts. For example, the GNU-ARM compiler provides the __attribute__((__interrupt__)) designation that will guarantee the 8-byte stack alignment. Typically, ISRs are application-specific (with the main purpose to produce events for active objects). Therefore, ISRs are not part of the generic QP port, but rather part of the BSP (Board Support Package). The following listing shows an example of the SysTick_Handler() ISR (from the DPP example application). This ISR calls the QF_TICK_X() macro to perform QF time-event management. @anchor arm-cm_qv-isr-code Listing: An ISR header for QV @code{c} void SysTick_Handler(void) __attribute__((__interrupt__)); void SysTick_Handler(void) { ~ ~ ~ QF_TICK_X(0U, &l_SysTick_Handler); /* process all armed time events */ } @endcode @note The QP port to ARM Cortex-M complies with the CMSIS standard, which dictates the names of all exception handlers and IRQ handlers. @section arm-cm_qv-fpu Using the FPU in the QV-nano Port (Cortex-M4F) If you have the Cortex-M4F CPU and your application uses the hardware FPU, it should be enabled because it is turned off out of reset. The CMSIS-compliant way of turning the FPU on looks as follows: @verbatim SCB->CPACR |= (0xFU << 20); @endverbatim @note The FPU must be enabled before executing any floating point instruction. An attempt to execute a floating point instruction will fault if the FPU is not enabled. Depending on whether or not you use the FPU in your ISRs, the QV port allows you to configure the FPU in various ways, as described in the following sub-sections. @subsection arm-cm_qv-fpu_noisr FPU NOT used in the ISRs If you use the FPU only at the thread-level (inside active objects) and none of your ISRs use the FPU, you can setup the FPU not to use the automatic state preservation and not to use the lazy stacking feature as follows: @verbatim FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); @endverbatim With this setting, the Cortex-M4F processor handles the ISRs in the exact-same way as Cortex-M0-M3, that is, only the standard interrupt frame with R0-R3,R12,LR,PC,xPSR is used. This scheme is the fastest and incurs no additional CPU cycles to save and restore the FPU registers. @note This FPU setting will lead to FPU errors, if any of the ISRs indeed starts to use the FPU @subsection arm-cm_qv-fpu_isr FPU used in the ISRs If you use the FPU both at the thread-level (inside active objects) and in any of your ISRs as well, you should setup the FPU to use the automatic state preservation and the lazy stacking feature as follows: @verbatim FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); @endverbatim This will enable the lazy stacking feature of the Cortex-M4F processor [@ref ARM-AN298]. The the "automatic state saving" and "lazy stacking" are enabled by default, so you typically don't need to change these settings. @note As described in the ARM Application Note "Cortex-M4(F) Lazy Stacking and Context Switching" [@ref ARM-AN298], the FPU automatic state saving requires more stack plus additional CPU time to save the FPU registers, but only when the FPU is actually used. @section arm-cm_qv-idle QV Idle Processing Customization in QV_onIdle() When no events are available, the non-preemptive QV kernel invokes the platform-specific callback function QV_onIdle(), which you can use to save CPU power, or perform any other "idle" processing (such as Quantum Spy software trace output). @note The idle callback QV_onIdle() must be invoked with interrupts disabled, because the idle condition can be changed by any interrupt that posts events to event queues. QV_onIdle() must internally enable interrupts, ideally atomically with putting the CPU to the power-saving mode (see also [Samek 07] and Chapter 7 in [PSiCC2]). Because QV_onIdle() must enable interrupts internally, the signature of the function depends on the interrupt locking policy. In case of the simple "unconditional interrupt locking and unlocking" policy, which is used in this ARM Cortex-M port, the QV_onIdle() takes no parameters. Listing 6 shows an example implementation of QV_onIdle() for the TM4C MCU. Other ARM Cortex-M embedded microcontrollers (e.g., NXP’s LPC1114/1343) handle the power-saving mode very similarly. @anchor arm-cm_qv_onidle-code Listing: QV_onIdle() for ARM Cortex-M @code{c} [1] void QV_onIdle(void) { /* entered with interrupts DISABLED, see NOTE01 */ ~ ~ ~ [2] #if defined NDEBUG /* Put the CPU and peripherals to the low-power mode */ [3] QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else [4] QF_INT_ENABLE(); /* just enable interrupts */ #endif } @endcode
  • 1 The cooperative QV kernel calls the QV_onIdle() callback with interrupts disabled, to avoid race condition with interrupts that can post events to active objects and thus invalidate the idle condition.
  • 2 The sleep mode is used only in the non-debug configuration, because sleep mode stops CPU clock, which can interfere with debugging.
  • 3 The macro QV_CPU_SLEEP() is used to put the CPU to the low-power sleep mode safely. The macro QV_CPU_SLEEP() is defined in the qv_port.h header file for the QV kernel and depends on the interrupt disabling policy used.
  • 4 When a sleep mode is not used, the QV_onIdle() callback simply re-enables interrupts.
@next{arm-cm_qk} */ /*##########################################################################*/ /*! @page arm-cm_qk Preemptive Run-to-Completion QK-nano Kernel @tableofcontents

The preemptive, run-to-completion (RTC) QK-nano kernel breaks entirely with the endless-loop structure of the thread routines and instead uses threads structured as one-shot, discrete, run-to-completion functions, very much like ISRs [PSiCC2, Chapter 10]. In fact, the QK-nano kernel views interrupts very much like threads of a "super-high" priority, except that interrupts are prioritized in hardware by the interrupt controller, whereas threads are prioritized in software by the RTC kernel.

@note The preemptive QK-nano kernel uses only one stack for all threads (see the next section), but the stack must be bigger than in the non-preemptive QV kernel. You need to adjust the size of this stack to be large enough for your application. As a fully preemptive multithreading kernel, QK-nano must ensure that at all times the CPU executes the highest-priority thread (active object) that is ready to run. Fortunately, only two scenarios can lead to readying a higher-priority thread:
  • 1 When a lower-priority thread posts an event to a higher-priority thread, the kernel must immediately suspend the execution of the lower-priority thread and start the higher-priority thread. This type of preemption is called synchronous preemption because it happens synchronously with posting an event to the thread's event queue. > NOTE: The stack usage shown in the bottom panel displays stack growing down (towards lower addresses), as it is the case in ARM Cortex-M.
@anchor arm-cm_qk-synch-fig @image html qk_synch.gif "Synchronous Preemption in QK"
  • 2 When an interrupt posts an event to a higher-priority thread than the interrupted thread, upon completion of the ISR the kernel must start execution of the higher-priority thread instead of resuming the lower-priority thread. This type of preemption is called asynchronous preemption because it can happen asynchronously, any time interrupts are not explicitly disabled. > NOTE: The stack usage during asynchronous preemption on ARM Cortex-M is slightly simplified in the diagram below. A more detailed stack usage diagram is discussed later in the section explaining the @ref "Detailed stack allocation in QK-nano for ARM Cortex-M".
@anchor arm-cm_qk-asynch-fig @image html qk_asynch.gif "Synchronous Preemption in QK" @note A traditional RTOS kernel does not distinguish between the synchronous and asynchronous preemptions and makes all preemptions look like the more stack-intensive asynchronous preemptions. In contrast, a RTC kernel can implement synchronous preemption as a simple function call (to QK_activate_()), which is much more efficient than a full context-switch. @section arm-cm_qk-synopsis Synopsis of the QK-nano Port on ARM Cortex-M The ARM Cortex-M architecture is designed primarily for the traditional real-time kernels that use multiple per-thread stacks. This section explains how the run-to-completion preemptive QK-nano kernel works on ARM Cortex-M. 1. The ARM Cortex-M processor executes the QK-nano application code (active objects) in the Privileged Thread mode, which is exactly the mode entered out of reset. The exceptions (including all interrupts) are always processed in the Privileged Handler mode. 2. QK-nano uses only the Main Stack Pointer (QK-nano is a single stack kernel). The Process Stack Pointer is not used and is not initialized. 3. ARM Cortex-M enters interrupt context without disabling interrupts (without setting the PRIMASK bit or the BASEPRI register). Generally, you should not disable interrupts inside your ISRs. In particular, the QP services QF_PUBLISH(), QF_TICK_X(), and QACTIVE_POST() should be called with interrupts enabled, to avoid nesting of critical sections. (NOTE: If you don’t wish an interrupt to be preempted by another interrupt, you can always prioritize that interrupt in the NVIC to a higher level -- use a lower numerical value of priority). 4. The QK-nano port uses the PendSV exception (number 14) and the NMI exception (number 2) to perform asynchronous preemption and return to the preempted thread, respectively (see Chapter 10 in [PSiCC2]). The startup code must initialize the Interrupt Vector Table with the addresses of @c PendSV_Handler() and @c NMI_Handler() exception handlers. 5. The QF_init() function calls the function QK_init() to set the priority of the PendSV exception to the lowest level in the whole system (0xFF). The function QK_init() additionally sets the interrupt priority of all IRQs available in the MCU to the safe value of @c QF_BASEPRI (for ARM-v7 architecture). 6. It is strongly recommended that you do not assign the lowest priority (0xFF) to any interrupt in your application. With 3 MSB-bits of priority, this leaves the following 7 priority levels for you (listed from the lowest to the highest urgency): 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20, and 0x00 (the highest priority). 7. Before returning, every "kernel aware" ISR must check whether an active object has been activated that has a higher priority than the currently running active object. If this is the case, the ISR must set the PensSV pending flag in the NVIC. All this is accomplished in the macro QK_ISR_EXIT(), which must be called just before exiting every ISRs. 8. In ARM Cortex-M the whole prioritization of interrupts, including the PendSV exception, is performed entirely by the NVIC. Because the PendSV has the lowest priority in the system, the NVIC tail-chains to the PendSV exception only after exiting the last nested interrupt. 9. The pushing of the 8 registers comprising the ARM Cortex-M interrupt stack frame upon entry to NMI exception is wasteful in a single-stack kernel, but is necessary to perform full interrupt return to the preempted context through the NMI's return. @subsection arm-cm_qk-preempt Preemption Scenarios in QK-nano on ARM Cortex-M @anchor arm-cm_qk-arm-cm-fig @image html qk_arm-cm.gif "Several preemption scenarios in QK"
  • 0 The timeline begins with the QK-nano executing the idle loop.
  • 1 At some point an interrupt occurs and the CPU immediately suspends the idle loop, pushes the interrupt stack frame to the Main Stack and starts executing the ISR.
  • 2 The ISR performs its work, and in QK-nano always must call the QK_ISR_EXIT() macro, which calls the QK-nano scheduler to determine if there is a higher-priority AO to run. If so, the macro sets the pending flag for the PendSV exception in the NVIC. The priority of the PendSV exception is configured to be the lowest of all exceptions, so the ISR continues executing and PendSV exception remains pending. At the ISR return, the ARM Cortex-M CPU performs tail-chaining to the pending PendSV exception.
  • 3 The PendSV exception discovers whether there is a higher-priority thread to run then the preempted one (by calling QK_schedPrio_()) and if so, to to synthesize an exception stack frame to return to the QK-nano scheduler (QK_sched_()) to run this new thread. > NOTE: The QK-nano scheduler must run in the thread context, while PendSV executes in the exception context. The change of the context is accomplished by returning from the PendSV exception directly to the QK-nano scheduler. To return directly to the QK-nano scheduler, PendSV synthesizes an exception stack frame, which contains the exception return address set to QK_sched_(). The QK-nano scheduler discovers that the Low-priority thread is ready to run (the ISR has posted event to this thread). The QK-nano scheduler enables interrupts and launches the Low-priority thread, which is simply a C-function call in QK. The Low-priority thread (active object) starts running.
  • 4 Some time later a low-priority interrupt occurs. The Low-priority thread is suspended and the CPU pushes the interrupt stack frame to the Main Stack and starts executing the ISR.
  • 5 Before the Low-priority ISR completes, it too gets preempted by a High-priority ISR. The CPU pushes another interrupt stack frame and starts executing the High-priority ISR.
  • 6 The High-priority ISR sets the pending flag for the PendSV exception by means of the QK_ISR_EXIT() macro. When the High-priority ISR returns, the NVIC does not tail-chain to the PendSV exception, because a higher-priority ISR than PendSV is still active. The NVIC performs an exception return to the preempted Low-priority interrupt, which finally completes.
  • 7 Upon the exit from the Low-priority ISR, it too sets the pending flag for the PendSV exception by means of the QK_ISR_EXIT() macro. The PendSV is already pended from the High-priority interrupt, so pending is again is redundant, but it is not an error. At the ISR return, the ARM Cortex-M CPU performs tail-chaining to the pending PendSV exception.
  • 8 The PendSV exception synthesizes an interrupt stack frame to return to the QK-nano scheduler. The QK-nano scheduler detects that the High-priority thread is ready to run and launches the High-priority thread (normal C-function call). The High-priority thread runs to completion and returns to the scheduler.
  • 9 The QK-nano scheduler does not find any more higher-priority threads to execute and needs to return to the preempted thread. The only way to restore the interrupted context in ARM Cortex-M is through the interrupt return, but the thread is executing outside of the interrupt context (in fact, threads are executing in the Privileged Thread mode). The thread enters the Handler mode by pending the NMI exception. > NOTE: The NMI exception is pended while interrupts are still disabled. This is not a problem, because NMI cannot be masked by disabling interrupts, so runs without any problems.
  • 10 The only job of the NMI exception is to discard its own interrupt stack frame, re-enable interrupts, and return using the interrupt stack frame that has been on the stack from the moment of thread preemption.
  • 11 The Low-priority thread, which has been preempted all that time, resumes and finally runs to completion and returns to the QK-nano scheduler. The QK-nano scheduler does not find any more threads to launch and causes the NMI exception to return to the preempted thread.
  • 12 The NMI exception discards its own interrupt stack frame and returns using the interrupt stack frame from the preempted thread context
@section arm-cm_qk-qf_port The qf_port.h Header File The QF header file for the ARM Cortex-M port is located in /ports/arm-cm/qk/gnu/qf_port.h. This file is almost identical to the @ref arm-cm_qv-qf_port "QV port", except the header file in the QK-nano port includes `qk_port.h` header file instead of `qv_porth`. @section arm-cm_qk-qk_port The qk_port.h Header File You configure and customize QK-nano through the header file qk_port.h, which is located in the QP ports directory /ports/arm-cm/qk/gnu/. The most important function of qk_port.h is specifying interrupt entry and exit. @note As any preemptive kernel, QK-nano needs to be notified about entering the interrupt context and about exiting an interrupt context in order to perform a context switch, if necessary. @anchor arm-cm_qk_port-code Listing: qk_port.h header file for ARM Cortex-M @code{c} /* determination if the code executes in the ISR context */ [1] #define QK_ISR_CONTEXT_() (QK_get_IPSR() != (uint32_t)0) __attribute__((always_inline)) [2] static inline uint32_t QK_get_IPSR(void) { uint32_t regIPSR; __asm volatile ("mrs %0,ipsr" : "=r" (regIPSR)); return regIPSR; } /* QK-nano interrupt entry and exit */ [3] #define QK_ISR_ENTRY() ((void)0) [4] #define QK_ISR_EXIT() do { \ [5] QF_INT_DISABLE(); \ [6] if (QK_sched_() != (uint_fast8_t)0) { \ [7] (*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (uint32_t)(1U << 28)); \ } \ [8] QF_INT_ENABLE(); \ } while (0) /* initialization of the QK-nano kernel */ [9] #define QK_INIT() QK_init() void QK_init(void); #include "qk.h" /* QK-nano platform-independent public interface */ @endcode
  • 1 The macro @c QK_ISR_CONTEXT() returns true when the code executes in the ISR context and false otherwise. The macro takes advantage of the ARM Cortex-M register IPSR, which is non-zero when the CPU executes an exception (or interrupt) and is zero when the CPU is executing thread code. > NOTE: QK-nano needs to distinguish between ISR and thread contexts, because threads need to perform synchronous context switch (when a higher-priority thread becomes ready to run), while ISRs should not do that.
  • 2 The inline function @c QK_get_IPSR() obtains the IPSR register and returns it to the caller. This function is defined explicitly for the GNU-ARM toolchain, but many other toolchains provide this function as an intrinsic, built-in facility.
  • 3 The @c QK_ISR_ENTRY() macro notifies QK-nano about entering an ISR. The macro is empty, because the determination of the ISR vs thread context is performed independently in the @c QK_ISR_CONTEXT() macro (see above).
  • 4 The @c QK_ISR_EXIT() macro notifies QK-nano about exiting an ISR.
  • 5 Interrupts are disabled before calling QK-nano scheduler.
  • 6 The QK-nano scheduler is called to find out whether an active object of a higher priority than the current one needs activation. The @c QK_sched_() function returns non zero value if this is the case.
  • 7 If asynchronous preemption becomes necessary, the code sets the PENDSV Pend bit(28) in the ICSR register (Interrupt Control and State Register). The register is mapped at address 0xE000ED04 in all ARM Cortex-M cores.
  • 8 The interrupts are re-enabled after they have been disabled in step [5]. > NOTE: Because the priority of the PendSV exception is the lowest of all interrupts, it is actually triggered only after all nested interrupts exit. The PendSV exception is then entered through the efficient **tail-chaining** process, which eliminates the restoring and re-entering the interrupt context.
@section arm-cm_qk-qk_impl QK-nano Port Implementation for ARM Cortex-M The QK-nano port to ARM Cortex-M requires coding the PendSV and NMI exceptions in assembly. This ARM Cortex-M-specific code, as well as QK-nano initialization (@c QK_init()) is located in the file ­ports/arm-cm/­qk/­gnu/qk_port.c @note The single assembly module `qk_port.s` contains common code for all Cortex-M variants (Architecture v6M and v7M) as well as options with and without the VFP. The CPU variants are distinguished by conditional compilation, when necessary. @subsection arm-cm_qk_port-asm_init QK_init() Implementation Listing: QK_init function in qk_port.s assembly file @code{c} /***************************************************************************** * The QK_init() function sets the priority of PendSV to 0xFF (lowest urgency). * For Cortex-M3/4/7, it also sets priorities of all other exceptions and IRQs * to the safe value. All this is performed in a nestable critical section. *****************************************************************************/ .section .text.QK_init .global QK_init .type QK_init, %function [1] QK_init: [2] MRS r0,PRIMASK /* store the state of the PRIMASK in r0 */ [3] MOV r12,r0 /* r12 := PRIMASK */ [4] CPSID i /* PRIMASK := 1 */ [5] .if __ARM_ARCH == 6 /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ [6] LDR r3,=0xE000ED18 /* System Handler Priority Register */ [7] LDR r2,[r3,#8] /* r2 := SYSPRI3 */ [8] MOVS r0,#0xFF [9] LSLS r0,r0,#16 [10] ORRS r2,r1 [11] STR r2,[r3,#8] /* SYSPRI3 := r2, PendSV <- 0xFF */ [12] .else /* M3/M4 */ /* NOTE: * On Cortex-M3/M4/.., this QK-nano port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. */ /* set all priority bytes to QF_BASEPRI in r1 */ [13] MOVS r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI LDR r3,=0xE000ED18 /* System Handler Priority Register */ LDR r2,[r3] /* r2 := SYSPRI1 */ ORRS r2,r1 /* r2 |= "all values to QF_BASEPRI" */ [14] STR r2,[r3] /* SYSPRI1 |= r2, Use-fault/Bus-fault/Mem-fault*/ LDR r2,[r3,#4] /* r2 := SYSPRI2 */ ORRS r2,r1 /* r2 |= "all values to QF_BASEPRI" */ [16] STR r2,[r3,#4] /* SYSPRI2 := r2, SVCall */ LDR r2,[r3,#8] /* r2 := SYSPRI3 */ ORRS r1,r1,#(0xFF << 16) /* r1 |= 0xFF for PendSV */ ORRS r2,r1 [17] STR r2,[r3,#8] /* SYSPRI3 |= r2, SysTick/PendSV/Debug */ /* set again all prioriy bytes to QF_BASEPRI in r1 */ [18] MOVS r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI LSLS r1,r1,#8 ORRS r1,r1,#QF_BASEPRI [19] LDR r3,=0xE000E004 /* Interrupt Controller Type Register */ LDR r3,[r3] /* r3 := INTLINESUM */ LSLS r3,r3,#3 [20] ADDS r3,r3,#8 /* r3 == number of NVIC_PRIO registers */ /* loop over all implemented NVIC_PRIO registers for IRQs... */ QK_init_irq: SUBS r3,r3,#1 LDR r2,=0xE000E400 /* NVIC_PRI0 register */ [21] STR r1,[r2,r3,LSL #2] /* NVIC_PRI0[r3] := r1 */ CMP r3,#0 BNE QK_init_irq .endif /* M3/M4 */ [22] MOV r0,r12 /* r0 := original PRIMASK */ [23] MSR PRIMASK,r0 /* PRIMASK := r0 */ [24] BX lr .size QK_init, . - QK_init @endcode
  • 1 The QK_init() function initializes the exception priorities of PendSV and NMI as well as interrupt priorities of all IRQs available in a given MCU (for Cortex-M3/4/7).
  • 2 The PRIMASK register is retreived into r0.
  • 3 The PRIMASK value is stored in the high-register r12.
  • 4 Interrupts are disabled by setting the PRIMASK.
  • 5 For the ARMv6-M architecture...
  • 6 The address of the NVIC System Handler Priority Register 0 is loaded into r3
  • 7 The contents of the NVIC System Handler Priority Register 2 (note the offset of 8) is loaded into r2.
  • 8-9 The mask value of 0xFF0000 is synthesized in r2.
  • 10 The mask is then applied to set the priority byte PRI_14 to 0xFF without changing other priority bytes in this register.
  • 11 The contents of r2 is stored in the NVIC System Handler Priority Register 2 (note the offset of 8).
  • 12 For the ARMv7-M architecture...
  • 13 The priority value QF_BASEPRI is all bytes of the register r1.
  • 14 The exception priorities for User-Fault, Bus-Fault, and Mem-Fault are set to the value QF_BASEPRI.
  • 16 The exception priority for SVCCall is set to the value QF_BASEPRI.
  • 17 The exception priority for SysTick, PendSV, and Debug is set to the value QF_BASEPRI.
  • 18 The priority value QF_BASEPRI is all bytes of the register r1 again.
  • 19 The value of Interrupt Controller Type Register is loaded into r3
  • 20 The number of implemented IRQs is loaded into r3
  • 21 The interrupt priority of all implemented IRQs is set to the safe value QF_BASEPRI in a loop.
  • 22 The original value of PRIMASK is restored form the high-register r12
  • 23 The PRIMASK register is restored to its original value
  • 14 The function QK_init returns to the caller.
@subsection arm-cm_qk_port-asm_pendsv PendSV_Handler() Implementation Listing: PendSV_Handler function in qk_port.s assembly file @code{c} .section .text.PendSV_Handler .global PendSV_Handler /* CMSIS-compliant exception name */ .type PendSV_Handler, %function [1] PendSV_Handler: /* Prepare some constants in registers before entering critical section */ [2] LDR r3,=0xE000ED04 /* Interrupt Control and State Register */ [3] MOVS r1,#1 [4] LSLS r1,r1,#27 /* r0 := (1 << 27) (UNPENDSVSET bit) */ /* <<<<<<<<<<<<<<<<<<<<<<< CRITICAL SECTION BEGIN <<<<<<<<<<<<<<<<<<<<< */ .if __ARM_ARCH == 6 /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ [6] CPSID i /* disable interrupts (set PRIMASK) */ .else /* M3/M4 */ .ifdef __FPU_PRESENT /* if VFP available... */ [7] PUSH {r0,lr} /* ... push EXC_RETURN plus stack-aligner */ .endif /* VFP */ [8] MOVS r0,#QF_BASEPRI [9] CPSID i /* selectively disable interrutps with BASEPRI */ [10] MSR BASEPRI,r0 /* apply the workaround the Cortex-M7 erraturm */ [11] CPSIE i /* 837070, see ARM-EPM-064408. */ .endif /* M3/M4 */ /* The PendSV exception handler can be preempted by an interrupt, * which might pend PendSV exception again. The following write to * ICSR[27] un-pends any such spurious instance of PendSV. */ [12] STR r1,[r3] /* ICSR[27] := 1 (unpend PendSV) */ /* The QK-nano activator must be called in a Thread mode, while this code * executes in the Handler mode of the PendSV exception. The switch * to the Thread mode is accomplished by returning from PendSV using * a fabricated exception stack frame, where the return address is * QK_activate_(). * * NOTE: the QK-nano activator is called with interrupts DISABLED and also * returns with interrupts DISABLED. */ [13] LSRS r3,r1,#3 /* r3 := (r1 >> 3), set the T bit (new xpsr) */ [14] LDR r2,=QK_activate_ /* address of QK_activate_ */ [15] SUBS r2,r2,#1 /* align Thumb-address at halfword (new pc) */ [16] LDR r1,=Thread_ret /* return address after the call (new lr) */ [17] SUB sp,sp,#8*4 /* reserve space for exception stack frame */ [18] ADD r0,sp,#5*4 /* r0 := 5 registers below the top of stack */ [19] STM r0!,{r1-r3} /* save xpsr,pc,lr */ [20] MOVS r0,#6 [21] MVNS r0,r0 /* r0 := ~6 == 0xFFFFFFF9 */ [22] BX r0 /* exception-return to the QK-nano activator */ .size PendSV_Handler, . - PendSV_Handler /* * Thread_ret is a helper function executed when the QXK activator returns. * * NOTE: Thread_ret does not execute in the PendSV context! * NOTE: Thread_ret executes entirely with interrupts DISABLED. */ .section .text.Thread_ret .type Thread_ret, %function [23] Thread_ret: /* After the QK-nano activator returns, we need to resume the preempted * thread. However, this must be accomplished by a return-from-exception, * while we are still in the thread context. The switch to the exception * context is accomplished by triggering the NMI exception. */ /* before triggering the NMI exception, make sure that the * VFP stack frame will NOT be used... */ .ifdef __FPU_PRESENT /* if VFP available... */ [24] MRS r0,CONTROL /* r0 := CONTROL */ [25] BICS r0,r0,#4 /* r0 := r0 & ~4 (FPCA bit) */ [26] MSR CONTROL,r0 /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ [27] ISB /* ISB after MSR CONTROL (ARM AN321,Sect.4.16)*/ .endif /* VFP available */ /* trigger NMI to return to preempted thread... * NOTE: The NMI exception is triggered with nterrupts DISABLED */ [28] LDR r0,=0xE000ED04 /* Interrupt Control and State Register */ [29] LSLS r1,r1,#31 /* r1 := (1 << 31) (NMI bit) */ [30] MOVS r1,#1 [31] STR r1,[r0] /* ICSR[31] := 1 (pend NMI) */ [32] B . /* wait for preemption by NMI */ .size Thread_ret, . - Thread_ret @endcode
  • 1 `PendSV_Handler` is a CMSIS-complinat name of the PendSV exception handler. The `PendSV_Handler` exception is always entered via tail-chaining from the last nested interrupt.
  • 2-4 Before interrupts are disabled, the following constants are loaded into registers: address of ICSR into r3 and (1<<27) into r1.
  • For the ARMv6-M architecture (Cortex-M0/M0+)...
  • 6 Interrupts are globally disabled by setting PRIMASK (see Section 3)
  • Otherwise, for the ARMv7-M architecture (Cortex-M3/4/7) and when the `_FPU_PRESENT` macro is defined... > NOTE: The symbol `__FPU_PRESENT` must be defined on the command-line to the GNU-ARM assembler if you intend to use the FPU on the Cortex-M4F cores.
  • 7 The lr register (EXC_RETURN) is pushed to the stack along with r0, to keep the stack aligned at 8-byte boundary. > NOTE: In the presence of the FPU (Cortex-M4F), the EXC_RETURN[4] bit carries the information about the stack frame format used, whereas EXC_RETURN[4] ==0 means that the stack contains room for the S0-S15 and FPSCR registers in addition to the usual R0-R3,R12,LR,PC,xPSR registers. This information must be preserved, in order to properly return from the exception at the end.
  • 8 For the ARMv7-M architecture (Cortex-M3/M4), interrupts are selectively disabled by setting the BASEPRI register. > NOTE: The value moved to BASEPRI must be identical to the QF_BASEPRI macro defined in `qf_port.h`.
  • 9 Before setting the BASEPRI register, interrupts are disabled with the PRIMASK register, which is the recommended workaround for the Cortex-M7 r0p1 hardware bug, as described in the ARM Ltd. [@ref ARM-EPM-064408], Erratum 837070.
  • 10 The BASEPRI register is set to the @c QF_BASEPRI value.
  • 11 After setting the BASEPRI register, interrupts are re-anabed with the PRIMASK register, which is the recommended workaround for the Cortex-M7 r0p1 hardware bug, as described in the ARM Ltd. [@ref ARM-EPM-064408], Erratum 837070.
  • 12 The PendSV exception is **explicitly** un-pended. > NOTE: The PendSV exception handler can be preempted by an interrupt, which might pend PendSV exception again. This would trigger PendSV incorrectly again immediately after calling QK-nano activator.
  • The following code [13-22] fabricates an exception stack frame, to perform an exception-return to the QK-nano activator without destroying the original exception stack frame of the PendSV exception. This is necessary to preserve the context of the preempted code.
  • 13 The value (1 << 24) is synthesized in r3 from the value (1 << 27) already available in r1. This value is going to be stacked and later restored to xPSR register (only the T bit set).
  • 14 The address of the QK-nano activator function @c QK_activate_ is loaded into r2. This will be pushed to the stack as the PC register value.
  • 15 The address of the QK-nano activator function @c QK_activate_ in r2 is adjusted to be half-word aligned instead of being an odd THUMB address. > NOTE: This is necessary, because the value will be loaded directly to the PC, which cannot accept odd values.
  • 16 The address of the Thread_ret function is loaded into r1. This will be pushed to the stack as the lr register value. > NOTE: The address of the @c Thread_ret label must be a THUMB address, that is, the least-significant bit of this address must be set (this address must be odd number). This is essential for the correct return of the QK-nano scheduler with setting the THUMB bit in the PSR. Without the LS-bit set, the ARM Cortex-M CPU will clear the T bit in the PSR and cause the Hard Fault. The GNU-ARM assembler/linker will synthesize the correct THUMB address of the svc_ret label only if this label is declared with the `.type Thread_ret , %function` attribute (see step [23]).
  • 16 The stack pointer is adjusted to leave room for 8 registers.
  • 18 The top of stack, adjusted by 5 registers, (r0, r1, r2, r3, and r12) is stored to r0.
  • 19 The values of xpsr, pc, and lr prepared in r3, r2, and r1, respectively, are pushed on the top of stack (now in r0). This operation completes the synthesis of the exception stack frame. After this step the stack looks as follows:
    Hi memory
               (optionally S0-S15, FPSCR), if EXC_RETURN[4]==0
               xPSR
               pc (interrupt return address)
               lr
               r12
               r3
               r2
               r1
               r0
               EXC_RETURN (pushed in step [7] if FPU is present)
    old SP --> "aligner"  (pushed in step [7] if FPU is present)
               xPSR == 0x01000000
               PC == QK_activate_
               lr == Thread_ret
               r12  don't care
               r3   don't care
               r2   don't care
               r1   don't care
        SP --> r0   don't care
    Low memory
    
  • 20-21 The special exception-return value 0xFFFFFFF9 is synthesized in r0 (two instructions are used to make the code compatible with Cortex-M0, which has no barrel shifter). > NOTE: the r0 register is used instead of lr because the Cortex-M0 instruction set cannot manipulate the higher-registers (r9-r15). > NOTE: The exception-return value is consistent with the synthesized stack-frame with the lr[4] bit set to 1, which means that the FPU registers are not included in this stack frame.
  • 22 PendSV exception returns using the special value of the r0 register of 0xFFFFFFF9 (return to Privileged Thread mode using the Main Stack pointer). The synthesized stack frame causes actually a function call to QK_sched_ function in C. > NOTE: The return from the PendSV exception just executed switches the ARM Cortex-M core to the Privileged Thread mode. The QK_sched_ function internally re-enables interrupts before launching any thread, so the threads always run in the Thread mode with interrupts enabled and can be preempted by interrupts of any priority. > NOTE: In the presence of the FPU, the exception-return to the QK-nano scheduler does not change any of the FPU status bit, such as CONTROL.FPCA or LSPACT.
  • 23 The @c Thread_ret function is the place, where the QK-nano activator `QK_activate_()` returns to, because this return address is pushed to the stack in step [16]. Please note that the address of the @c Thread_ret label must be a THUMB address.
  • 24-27 If the FPU is present, the read-modify-write code clears the CONTROL[2] bit [2]. This bit, called CONTROL.FPCA (Floating Point Active), would cause generating the FPU-type stack frame, which you want to avoid in this case (because the NMI exception will certainly not use the FPU). > NOTE: Clearing the CONTROL.FPCA bit occurs with interrupts disabled, so it is protected from a context switch.
  • 28-31 The asynchronous NMI exception is triggered by setting ICSR[31]. The job of this exception is to put the CPU into the exception mode and correctly return to the thread level.
  • 32 This endless loop should not be reached, because the NMI exception should preempt the code immediately after step [31]
@subsection arm-cm_qk_port-asm_nmi NMI_Handler() Implementation Listing: NMI_Handler function in qk_port.s assembly file @code{c} .section .text.NMI_Handler .global NMI_Handler .type NMI_Handler, %function [1] NMI_Handler: [2] ADD sp,sp,#(8*4) /* remove one 8-register exception frame */ .if __ARM_ARCH == 6 /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ [3] CPSIE i /* enable interrupts (clear PRIMASK) */ [4] BX lr /* return to the preempted thread */ .else /* M3/M4 */ [5] MOVS r0,#0 [6] MSR BASEPRI,r0 /* enable interrupts (clear BASEPRI) */ .ifdef __FPU_PRESENT /* if VFP available... */ [7] POP {r0,pc} /* pop stack "aligner" and EXC_RETURN to PC */ .else /* no VFP */ [8] BX lr /* return to the preempted thread */ .endif /* VFP available */ .endif /* M3/M4 */ .size NMI_Handler, . - NMI_Handler @endcode
  • 1 The @c NMI_Handler is the CMSIS-compliant name of the NMI exception handler. This exception is triggered after returning from the QK-nano activator in step [31] of the previous listing. The job of NMI is to discard its own stack frame and cause the exception-return to the original preempted thread context. The stack contents just after entering NMI is shown below:
    Hi memory
               (optionally S0-S15, FPSCR), if EXC_RETURN[4]==0
               xPSR
               pc (interrupt return address)
               lr
               r12
               r3
               r2
               r1
               r0
    old SP --> EXC_RETURN (pushed in PendSV [7] if FPU is present)
               "aligner"  (pushed in PendSV [7] if FPU is present)
               xPSR don't care
               PC   don't care
               lr   don't care
               r12  don't care
               r3   don't care
               r2   don't care
               r1   don't care
        SP --> r0   don't care
    Low memory
    
  • 2 The stack pointer is adjusted to un-stack the 8 registers of the interrupt stack frame corresponding to the NMI exception itself. This moves the stack pointer from the "old SP" to "SP" in the picture above, which "uncovers" the original exception stack frame left by the PendSV exception.
  • 3 For ARMv6-M, interrupts are enabled by clearing the PRIMASK.
  • 4 For ARMv6-M, The NMI exception returns to the preempted thread using the standard EXC_RETURN, which is in lr.
  • 5-6 For the ARMv7-M, interrupts are enabled by writing 0 into the BASEPRI register.
  • 7 If the FPU is used, the EXC_RETURN and the "stack aligner" saved in PendSV step [7] are popped from the stack into r0 and pc, respectively. Updating the pc causes the return from PendSV.
  • 8 Otherwise, NMI returns to the preempted thread using the standard EXC_RETURN, which is in lr.
@anchor qk_stack-detail @image html qk_stack-detail.gif "Detailed stack allocation in QK-nano for ARM Cortex-M" @section arm-cm_qk-isr Writing ISRs for QK The ARM Cortex-M CPU is designed to use regular C functions as exception and interrupt service routines (ISRs). @note The ARM EABI (Embedded Application Binary Interface) requires the stack be 8-byte aligned, whereas some compilers guarantee only 4-byte alignment. For that reason, some compilers (e.g., GNU-ARM) provide a way to designate ISR functions as interrupts. For example, the GNU-ARM compiler provides the `__attribute__((__interrupt__))` designation that will guarantee the 8-byte stack alignment. Typically, ISRs are application-specific (with the main purpose to produce events for active objects). Therefore, ISRs are not part of the generic QP port, but rather part of the BSP (Board Support Package). The following listing shows an example of the SysTick_Handler() ISR (from the DPP example application). This ISR calls the QF_TICK_X() macro to perform QF time-event management. @anchor arm-cm_qk-isr-code Listing: An ISR header for QK @code{c} void SysTick_Handler(void) __attribute__((__interrupt__)); void SysTick_Handler(void) { ~ ~ ~ [1] QK_ISR_ENTRY(); /* inform QK-nano about entering an ISR */ ~ ~ ~ QF_TICK_X(0U, &l_SysTick_Handler); /* process all armed time events */ ~ ~ ~ [2] QK_ISR_EXIT(); /* inform QK-nano about exiting an ISR */ } @endcode
  • 1 Every ISR for QK-nano must call @c QK_ISR_ENTRY() before calling any QP API
  • 2 Every ISR for QK-nano must call @c QK_ISR_EXIT() right before exiting to let the QK-nano kernel schedule an asynchronous preemption, if necessary.
@note The QK-nano port to ARM Cortex-M complies with the requirement of the ARM-EABI to preserve stack pointer alignment at **8-byte boundary**. Also, all QP examples for ARM Cortex-M comply with the CMSIS naming convention for all exception handlers and IRQ handlers. @section arm-cm_qk-fpu Using the FPU in the QK-nano Port (Cortex-M4F) If you have the Cortex-M4F CPU and your application uses the hardware FPU, it should be enabled because it is turned off out of reset. The CMSIS-compliant way of turning the FPU on looks as follows: @verbatim SCB->CPACR |= (0xFU << 20); @endverbatim @note The FPU must be enabled before executing any floating point instruction. An attempt to execute a floating point instruction will fault if the FPU is not enabled. Depending on wheter or not you use the FPU in your ISRs, the "Vanilla" QP port allows you to configure the FPU in various ways, as described in the following sub-sections. @subsection arm-cm_qk-fpu_1thread FPU used in ONE thread only and not in any ISR If you use the FPU only at a single thread (active object) and none of your ISRs use the FPU, you can setup the FPU not to use the automatic state preservation and not to use the lazy stacking feature as follows: @verbatim FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); @endverbatim With this setting, the Cortex-M4F processor handles the ISRs in the exact-same way as Cortex-M0-M3, that is, only the standard interrupt frame with R0-R3,R12,LR,PC,xPSR is used. This scheme is the fastest and incurs no additional CPU cycles to save and restore the FPU registers. @note This FPU setting will lead to FPU errors, if more than one thread or any of the ISRs indeed start to use the FPU @subsection arm-cm_qk-fpu_nthreadd FPU used in more than one thread only or the ISR If you use the FPU in more than one of the threads (active objects) or in any of your ISRs, you should setup the FPU to use the automatic state preservation and the lazy stacking feature as follows: FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); This is actually the default setting of the hardware FPU and is recommended for the QK-nano port, because it is safer in view of code evolution. Future changes to the application can easily introduce FPU use in multiple active objects, which would be unsafe if the FPU context was not preserved automatically. @note As described in the ARM Application Note "Cortex-M4(F) Lazy Stacking and Context Switching" [@ref ARM-AN298], the FPU automatic state saving requires more stack plus additional CPU time to save the FPU registers, but only when the FPU is actually used. @section arm-cm_qk-idle QK-nano Idle Processing Customization in QK_onIdle() QK-nano can very easily detect the situation when no events are available, in which case QK-nano calls the `QK_onIdle()` callback. You can use `QK_onIdle()` to suspended the CPU to save power, if your CPU supports such a power-saving mode. Please note that `QK_onIdle()` is called repetitively from an endless loop, which is the QK-nano idle-thread. The `QK_onIdle()` callback is called with interrupts **enabled** (which is in contrast to the @ref arm-cm_qv-idle "QV_onIdle() callback" used in the non-preemptive configuration). The THUMB-2 instruction set used exclusively in ARM Cortex-M provides a special instruction WFI (Wait-for-Interrupt) for stopping the CPU clock, as described in the "ARMv7-M Reference Manual" [ARM 06a]. The following listing shows the `QK_onIdle()` callback that puts ARM Cortex-M into a low-power mode. @anchor arm-cm_qk_onidle-code Listing: QV_onIdle() for ARM Cortex-M @code{c} [1] void QK_onIdle(void) { ~ ~ ~ [2] #if defined NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ [3] __WFI(); /* Wait-For-Interrupt */ #endif } @endcode
  • 1 The preemptive QK-nano kernel calls the `QK_onIdle()` callback with interrupts enabled.
  • 2 The sleep mode is used only in the non-debug configuration, because sleep mode stops CPU clock, which can interfere with debugging.
  • 3 The `WFI` instruction is generated using inline assembly.
@section arm-cm_qk-testing Testing QK-nano Preemption Scenarios The `bsp.c` file included in the examples/arm-cm/dpp_ek-tm4c123gxl/qk directory contains special instrumentation (an ISR designed for testing) for convenient testing of @ref arm-cm_qk-arm-cm-fig "various preemption scenarios in QK". The technique described in this section will allow you to trigger an interrupt at any machine instruction and observe the preemption it causes. The interrupt used for the testing purposes is the GPIOA interrupt (INTID == 0). The ISR for this interrupt is shown below: @code{c} void GPIOPortA_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK-nano about entering an ISR */ QACTIVE_POST(AO_Table, Q_NEW(QEvt, MAX_PUB_SIG), /* for testing... */ &l_GPIOPortA_IRQHandler); QK_ISR_EXIT(); /* inform QK-nano about exiting an ISR */ } @endcode `GPIOPortA_IRQHandler()`, as all interrupts in the system, invokes the macros QK_ISR_ENTRY() and QK_ISR_EXIT(), and also posts an event to the Table active object, which has higher priority than any of the Philo active object. The figure below hows how to trigger the GPIOA interrupt from the CCS debugger. From the debugger you need to first open the register window and select NVIC registers from the drop-down list (see right-bottom corner of Figure 6).You scroll to the NVIC_SW_TRIG register, which denotes the Software Trigger Interrupt Register in the NVIC. This write-only register is useful for software-triggering various interrupts by writing various masks to it. To trigger the GPIOA interrupt you need to write 0x00 to the NVIC_SW_TRIG by clicking on this field, entering the value, and pressing the Enter key. @image html arm-cm_qk_test-ccs.png "Triggering the GPIOA interrupt from Eclipse debugger" The general testing strategy is to break into the application at an interesting place for preemption, set breakpoints to verify which path through the code is taken, and trigger the GPIO interrupt. Next, you need to free-run the code (don’t use single stepping) so that the NVIC can perform prioritization. You observe the order in which the breakpoints are hit. This procedure will become clearer after a few examples. @subsection arm-cm_qk-test-isr Interrupt Nesting Test The first interesting test is verifying the correct tail-chaining to the PendSV exception after the interrupt nesting occurs, as shown in @ref arm-cm_qk-synch-fig "Synchronous Preemption in QK". To test this scenario, you place a breakpoint inside the `GPIOPortA_IRQHandler()` and also inside the `SysTick_Handler()` ISR. When the breakpoint is hit, you remove the original breakpoint and place another breakpoint at the very next machine instruction (use the Disassembly window) and also another breakpoint on the first instruction of the `QK_PendSV` handler. Next you trigger the PIOINT0 interrupt per the instructions given in the previous section. You hit the Run button. The pass criteria of this test are as follows: 1. The first breakpoint hit is the one inside the `GPIOPortA_IRQHandler()` function, which means that GPIO ISR preempted the SysTick ISR. 2. The second breakpoint hit is the one in the `SysTick_Handler()`, which means that the SysTick ISR continues after the PIOINT0 ISR completes. 3. The last breakpoint hit is the one in `PendSV_Handler()` exception handler, which means that the PendSV exception is tail-chained only after all interrupts are processed. You need to remove all breakpoints before proceeding to the next test. @subsection arm-cm_qk-test-thread Thread Preemption Test The next interesting test is verifying that threads can preempt each other. You set a breakpoint anywhere in the Philosopher state machine code. You run the application until the breakpoint is hit. After this happens, you remove the original breakpoint and place another breakpoint at the very next machine instruction (use the Disassembly window). You also place a breakpoint inside the `GPIOPortA_IRQHandler()` interrupt handler and on the first instruction of the `PendSV_Handler()` handler. Next you trigger the GPIOA interrupt per the instructions given in the previous section. You hit the Run button. The pass criteria of this test are as follows: 1. The first breakpoint hit is the one inside the `GPIOPortA_IRQHandler()` function, which means that GPIO ISR preempted the Philo thread. 2. The second breakpoint hit is the one in `PendSV_Handler()` exception handler, which means that the PendSV exception is activated before the control returns to the preempted Philosopher thread. 3. After hitting the breakpoint in `PendSV_Handler()`, you single step into `QK_activate_()`. You verify that the activator invokes a state handler from the Table state machine. This proves that the Table thread preempts the Philo thread. 4. After this you free-run the application and verify that the next breakpoint hit is the one inside the Philosopher state machine. This validates that the preempted thread continues executing only after the preempting thread (the Table state machine) completes. @subsection arm-cm_qk-test-fpu Testing the FPU (Cortex-M4F) In order to test the FPU, the Board Support Package (BSP) for the Cortex-M4F EK-TM4C123GXL board uses the FPU in the following contexts: - In the idle loop via the `QK_onIdle()` callback (QP priority 0) - In the thread level via the `BSP_random()` function called from all five Philo active objects (QP priorities 1-5). - In the thread level via the `BSP_displayPhiloStat()` function called from the Table active object (QP priorty 6) - In the ISR level via the `SysTick_Handler()` ISR (priority above all threads) To test the FPU, you could step through the code in the debugger and verify that the expected FPU-type exception stack frame is used and that the FPU registers are saved and restored by the "lazy stacking feature" when the FPU is actually used. Next, you can selectively comment out the FPU code at various levels of priority and verify that the QK-nano context switching works as expected with both types of exception stak frames (with and without the FPU). @subsection arm-cm_qk-test-other Other Tests Other interesting tests that you can perform include changing priority of the GPIOA interrupt to be lower than the priority of SysTick to verify that the PendSV is still activated only after all interrupts complete. In yet another test you could post an event to Philosopher active object rather than Table active object from the `GPIOPortA_IRQHandler()` function to verify that the QK-nano activator will not preempt the Philosopher thread by itself. Rather the next event will be queued and the Philosopher thread will process the queued event only after completing the current event processing. */ ================================================ FILE: doxygen/ports_native.dox ================================================ /*##########################################################################*/ /*! @page ports_native Native (Bare-Metal) Ports - @subpage lint (generic C compiler) - @subpage arm-cm (Cortex-M0/M0+/M3/M4/M4F) - @ref arm-cm_qv (ARM-KEIL, GNU-ARM, IAR-ARM, TI-CCS toolsets) - @ref arm-cm_qk (ARM-KEIL, GNU-ARM, IAR-ARM, TI-CCS toolsets) - @subpage arm7-9 ("classic" ARM) - @ref arm7-9_qk (GNU-ARM, IAR-ARM toolsets) - @ref arm7-9_qv (GNU-ARM, IAR-ARM toolsets) - @subpage avr (megaAVR) - @ref avr_qk (GNU-AVR, IAR-AVR toolsets) - @ref avr_qv (GNU-AVR, IAR-AVR toolsets) - @subpage msp430 ("classic" MSP430 and "extended" MSP430X) - @ref msp430_qv (CCS, IAR toolsets) - @ref msp430_qk (CCS, IAR toolsets) */ /*##########################################################################*/ /*! @page lint PC-Lint-Plus @tableofcontents

The QP-nano distribution contains a "port" to PC-Lint-Plus static analysis tool from Gimpel Software, which is a static analysis tool for C and C++ with one of the longest track records and best value of the money in the industry. The "PC-Lint-Plus port" allows you to statically analyze the QP-nano source code and facilitates static analysis of your **application code** based on QP-nano.

The QP-nano "port" to PC-Lint-Plus is located in the directory qpn/ports/lint-plus and includes also lint configuration files, as well as an example of "linting" application code in the directory qpn/examples/arm-cm/dpp_ek-tm4c123gxl/lint-plus. The following listing describes the most important files in these three directories. @code{.x} qpn\ - QP-nano installation directory | | +-ports/ - QP-nano ports directory | | +-lint-plus/ - QP-nano "port" to PC-Lint-Plus | | | +-qkn/ - QP-nano port with the QK-nano kernel | | | +-qvn/ - QP-nano port with the QV-nano kernel | | | +-au-ds.lnt - Dan Saks recommendations | | | +-au-misra3.lnt - MISRA-C:2012 compliance checks | | | +-au-misra3-amd1.lnt - MISRA-C:2012-Amendment-1 additional checks | | | +-qpn.lnt - PC-Lint-Plus options for QP-nano applications | | | +-std.lnt - Standard PC-Lint-Plus settings recommended by Quantum Leaps | | | +-lin.bat - Batch file to invoke PC-Lint-Plus to run analysis of QP-nano code | | | +-options.lnt - PC/Lint-Plus options for "linting" QP-nano source code | | | +-lint_qfn.log - PC/Lint-Plus output for the QEP/QF-nano components of QP-nano | | | +-lint_qvn.log - PC/Lint-Plus output for the QV-nano component of QP-nano | | | +-lint_qkn.log - PC/Lint-Plus output for the QK-nano component of QP-nano | | | +-qpn_conf.h - QP-nano config file for a "generic C compiler" | | | +-stdbool.h - Standard Boolean type and constants for a "generic C compiler" | | | +-stdint.h - Standard exact-width integers for a "generic C compiler" | | | +-examples\ - QP-nano examples directory (application) | | +-arm-cm\ - QP-nano examples for ARM Cortex-M | | | +-dpp_ek-tm4c123gxl\ - DPP example on the EK-TM4C123GLX board | | | | +-lint-plus\ - directory for linting the application | | | | | +-lin.bat - Batch to run PC-Lint-Plus analysis of application code | | | | | +-options.lnt - PC-Lint-Plus options for "linting" of application code @endcode @section lint_qpn Linting the QP-nano Source Code The directory qpn/ports/lint-plus (see listing above) contains also the **lin.bat** batch file for "linting" the QP-nano source code. The `lin.bat` batch file invokes PC-Lint-Plus and generates the lint output files. As shown in the listing above, the lint output is collected into four text files `lint_qfn.log`, lint_qkn.log`, and `lint_qvn.log`, for QEP/QF-nano, QK-nano, and QV-nano components of the QP-nano framework, respectively. @note In order to execute the `lin.bat` file on your system, you might need to adjust the symbol `PCLP_DIR` at the top of the batch file, to the PC-Lint-Plus installation directory on your computer. According to the PC-Lint-Plus guidelines, the `lin.bat` uses two option files: the `qpn.lnt` configuration file discussed before and the `options.lnt` configuration file that covers all deviations from the MISRA-C rules **within the QP-nano source code**. These deviations are intentionally localized to QP-nano code and are independent from your **application-level** code. In other words, a MISRA-C deviation present in the QP-nano code does **not** mean that such deviation is somehow allowed or its detection is somehow suppressed in the **application-level** code. This is because the the `options.lnt` configuration file for internals of QP-nano is **not** used to "lint" the application-level code. @section lint_app Linting QP-nano Application Code The QP-nano baseline code contains an example of MISRA-C compliance checking with PC-Lint-Plus: the DPP example for the EK-TM4C123GLX Cortex-M4F board, located in the directory qpn/examples/arm-cm/dpp_ek-tm4c123gxl/lint-plus. The PC-Lint-Plus analysis is very simple and requires invoking the **lin.bat** file. @note In order to execute the **lin.bat** file on your system, you might need to adjust the symbol `PCLP_DIR` at the top of the batch file, to the PC-Lint-Plus installation directory on your computer. You The `lint-plus` subdirectory contains also the `options.lnt` with the PC-Lint-Plus options specific to linting the application. Here, you might include linting options for your specific compiler, as described in the "PC-Lint-Plus Manual", Chapter 2 "Installation and Configuration". @section lint_options Structure of PC-Lint-Plus Options for QP-nano PC-Lint-Plus has several places where it reads its currently valid options: - From special PC-Lint-Plus option files (usually called `*.lnt`) - From the command line - From within the special lint-comments in the source code modules (not recommended) The QP-nano source code and example application code has been "linted" only by means of the first alternative (option files) with possibility of adding options via command line. The third alternative--lint comments--is not used and Quantum Leaps does not recommend this alternative. @note The QP-nano source code is completely free of lint comments, which are viewed as a contamination of the source code. The structure of the PC-Lint-Plus option files used for "linting" QP-nano follows exactly the Gimpel Software guidelines for configuring PC-Lint-Plus (See Section 2 "Configuration" in the *PC-Lint-Plus Manual*). The design and grouping of the lint options also reflects the fact that static code analysis of a software framework, such as QP-nano, has really two major aspects. First, the source code of the framework itself has to be analyzed. But even more important and helpful to the users of the framework is providing the infrastructure to effectively analyze the application-level code based on the framework. With this in mind, the PC-Lint-Plus options for static analysis of QP-nano are divided into two groups, located in directories qpn/include and qpn/ports/lint. These two groups are for analyzing QP-nano **applications** and QP-nano **source code**, respectively. As shown in the PC-Lint-Plus "port" files description, the directory qpn/include, contains the PC-Lint-Plus options for "linting" the application code along with all platform-independent QP-nano header files required by the applications. This collocation of lint options with header files simplifies "linting", because specifying just `-iqpn/include` include directory to PC-Lint-Plus accomplishes both inclusion of QP-nano header files and PC-Lint-Plus options. Note that the `qpn/include` directory contains all PC-Lint-Plus option files used in "linting" the code, including the standard MISRA-C:2012 `au-misr3.lnt` option file as well as Dan Saks' recommendations `au-ds.lnt`, which are copied from the PC-Lint-Plus distribution. This design freezes the lint options for which the compliance has been checked. @subsection lint_std_lnt The std.lnt option file According to the Gimpel Software *PC-Lint-Plus Configuration Guidelines*, the file `qpn/ports/lint-plus/std.lnt` file, contains the top-level options, which Quantum Leaps recommends for all projects. These options include the formatting of the PC-Lint-Plus messages and making two passes to perform better cross-module analysis. However, the most important option is `-restore_at_end`, which has the effect of surrounding each source file with options `-save` and `-restore`. This precaution prevents options from "bleeding" from one file to another. Top-level option file std.lnt @include std.lnt @subsection lint_qpn_lnt The qpn.lnt option file The most important file for "linting" QP-nano applications is the **qpn.lnt** option file. This file handles all deviations from the MISRA-C:2012 rules, which might arise at the application-level code from the use of the QP-nano framework. In other words, the **qpn.lnt** option file allows completely clean "linting" of the application-level code, as long as the application code does not violate any of the MISRA-C:2012 rules. At the same time, the **qpn.lnt** option file has been very carefully designed not to suppress any MISRA-C:2012 rule checking outside the very specific context of the QP-nano API. In other words, the qpn.lnt option file still supports 100% of the MISRA-C:2012 rule checks that PC-Lint-Plus is capable of performing. @remarks For example, for reasons explained in Section 5.10 of the "QP-nano MISRA Compliance Matrix", QP-nano extensively uses function-like macros, which deviates from the MISRA-C:2012 advisory Rule 4.9 and which PC-Lint-Plus checks with the warning 9026. However, instead of suppressing this warning globally (with the -e9096 directive), the qpn.lnt option file suppresses warning 9096 only for the specific QP function-like macros that are visible to the application level. So specifically, the qpn.lnt file contains directives `-esym(9026, Q_TRAN, Q_SUPER, ...)`, which suppresses the warning only for the specified macros, but does not disable checking of any other macros in the application-level code. @next{arm-cm} */ /*##########################################################################*/ /*! @page arm-cm ARM Cortex-M @image html under_construction.jpg @section arm7-9_qk Preemptive QK Kernel @includelineno ports/arm-sm/qk/iar/qkn_port.s @next{arm7-9} */ /*##########################################################################*/ /*! @page arm7-9 ARM7/ARM9 @image html under_construction.jpg @section arm7-9_qk Preemptive QK Kernel @includelineno ports/arm7-9/qk/iar/qkn_port.s @section arm7-9_qv Cooperative QV Kernel @next{msp430} */ /*##########################################################################*/ /*! @page msp430 MSP430 @image html under_construction.jpg @section msp430_qk Preemptive QK Kernel @section msp430_qv Cooperative QV Kernel @next{avr} */ /*##########################################################################*/ /*! @page avr AVR @image html under_construction.jpg @section avr_qk Preemptive QK Kernel @section avr_qv Cooperative QV Kernel */ ================================================ FILE: doxygen/ports_os.dox ================================================ /*##########################################################################*/ /*! @page ports_os Ports to Third-Party OS - @subpage posix-qv (Linux, embedded-Linux, BSD, etc.) - @subpage win32-qv (Windows with QV) */ /*##########################################################################*/ /*! @page posix-qv POSIX-QV @image html under_construction.jpg @sa @ref exa_posix-qv "Examples for POSIX-QV" */ /*##########################################################################*/ /*! @page win32-qv Win32-QV @image html under_construction.jpg @sa @ref exa_win32-qv "Examples for Win32-QV" */ ================================================ FILE: doxygen/preview.js ================================================ /* Image preview script * powered by jQuery (http://www.jquery.com) * written by Alen Grakalic (http://cssglobe.com) * for more info visit * http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery */ this.imagePreview = function(){ // you might want to adjust to get the right result horOffset = -100; verOffset = 0; /* END CONFIG */ $("a.preview").hover(function(e){ this.t = this.title; this.title = ""; var c = (this.t != "") ? "
" + this.t : ""; $("body").append("

Image preview"+ c +"

"); $("#preview") .css("top",(e.pageY - verOffset) + "px") .css("left",(e.pageX + horOffset) + "px") .fadeIn("fast"); }, function(){ this.title = this.t; $("#preview").remove(); }); $("a.preview").mousemove(function(e){ $("#preview") .css("top",(e.pageY - verOffset) + "px") .css("left",(e.pageX + horOffset) + "px"); }); }; // starting the script on page load $(document).ready(function(){ imagePreview(); }); ================================================ FILE: doxygen/rsm.bat ================================================ @echo off :: ========================================================================== :: Product: QP-nano script for running MSquared Resource Standard Metrics (RSM) :: Last Updated for Version: 5.2.0 :: Date of the Last Update: Dec 20, 2013 :: :: Q u a n t u m L e a P s :: --------------------------- :: innovating embedded systems :: :: Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. :: :: This program is open source software: you can redistribute it and/or :: modify it under the terms of the GNU General Public License as published :: by the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: Alternatively, this program may be distributed and modified under the :: terms of Quantum Leaps commercial licenses, which expressly supersede :: the GNU General Public License and are specifically designed for :: licensees interested in retaining the proprietary status of their code. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see . :: :: Contact information: :: Quantum Leaps Web sites: http://www.quantum-leaps.com :: http://www.state-machine.com :: e-mail: info@quantum-leaps.com :: ========================================================================== setlocal set RCMHOME="C:\tools\MSquared\M2 RSM" set RSM_OUTPUT=qpn_metrics.txt set RSM_INPUT=..\include\*.h ..\source\*.h ..\source\*.c %RCMHOME%\rsm.exe -fd -n -xNOCOMMAND -xNOCONFIG -u"File cfg rsm_qpn.cfg" %RSM_INPUT% > %RSM_OUTPUT% endlocal ================================================ FILE: doxygen/rsm_qpn.cfg ================================================ # ========================================================================== # Product: Configuration file for MSquared Resource Standard Metrics (RSM) # Last Updated for Version: 5.2.0 # Date of the Last Update: Dec 20, 2013 # # Q u a n t u m L e a P s # --------------------------- # innovating embedded systems # # Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # Quantum Leaps Web sites: http://www.quantum-leaps.com # http://www.state-machine.com # e-mail: info@quantum-leaps.com # ========================================================================== #################################################################### # RSM Operational Configuration #################################### # Company Specific Header # This line will appear at the top of all reports # Typical uses include copyrights, security and project markings # You must specify both a text version for text and csv reports # and an HTML version. Report Header Active : No Report Header Text Line : Standard Metrics Report Report Header HTML Line :           Standard Metrics Report # Enable user defined configuration files. # The file rsm.cfg is read from the location of the rsm.lic file. # This file can enable this option to allow users to override the # operational configuration of RSM. This option is enabled by the # end user with the -u "File cfg path\file" option Enable user defined configuration files : Yes # Windows 9x and DOS are case insensitive file systems. # Files like foo.c and foo.C are seen as C source files. # If *.C files are C++ files under these operating systems # or you are operating on NT or UNIX set this option to # case sensitivity equal to Yes. Source file names are case sensitive : No # Show a progress indicator when processing files and # code differentials. Show progress indicator : Yes Detailed Progress Showing File Names : Yes # Number of files which comprise a status marker when # status is indicated during lengthy operations. Progress status interval number of files: 10 # Show file dates when displaying file metrics. Show file date and size : No # RSM will process only files with the following extensions. # The user may add to this list, but RSM is designed to process # only the C, C++, C# and Java languages. Validate file extensions for processing : Yes # Specify the extensions for each type of supported language. # Files extensions are separated by commas and are case sensitive # if case sensitivity is specified in this file (comma separated,no spaces). C File Extensions : c C Header File Extensions : h C++ File Extensions : cc,cpp,cxx,h,hh,H,hxx C++ Header File Extensions : h,hh,H,hxx C# File Extensions : cs Java File Extensions : java # Other files are not officially supported by RSM # but lines will be counted as LOC Other File Extensions : # When analyzing *.h files, treat header files as # both C and C++. If you use separate extensions for C++ and # C header files, then set this option to No. Treat C headers as C++ : Yes # RSM will not process files when the path/file name contains # a pattern in the pattern list (comma separated,no spaces). Pattern Filter Active : No Pattern Filter : .designer.c # RSM Code skip strings allow the RSM parser to skip # processing of all code between the start and stop # tokens. This is useful for machine generated code. # Code tokens are unique in the could base and if # found on a code line the rsm processing will be effected. # Start and stop tokens must match within a file and # cannot span files. A token cannot contain spaces and # must be alphnumeric and can contain the underscore. # Quality skip tokens turn off just quality notice checking. # i.e. // RSM_IGNORE_BEGIN # some code .... # // RSM_IGNORE_END RSM Code Skip Start Token : RSM_IGNORE_BEGIN RSM Code Skip End Token : RSM_IGNORE_END RSM Code Quality Skip Start Token : RSM_IGNORE_QUALITY_BEGIN RSM Code Quality Skip End Token : RSM_IGNORE_QUALITY_END Activate RSM code skip tokens : Yes # RSM will not process files in local directories when this # flag is set. This will prevent recursive descent into # these directories (comma separated,no spaces). Do not process these local directories : No Local directory names not processed : test,sccs,cvs,rcs,svn # Names in reports include file, namespace or package, class # and function names. These names can get quite long and will # extend beyond the report right margin. This setting will # wrap the name to the report right margin. Wrap long names in reports : Yes #################################################################### # RSM Configuration for Baseline Metrics Differentials ############# # The following path location specifies where work files # are to be created. The path must be a location with write # permissions. RSM will create work files in the current # directory if no path is specified. Work file location path : # When processing code line differentials, ignore # blank line changes in the code. Ignore code differential blank lines : Yes # When processing code line differentials, ignore # blanks and tab changes in the code. Ignore code differential white space : Yes # Maximum number of lines in a file when using Longest Common Sequence # differential algorithm. This value establishes the line to line # comparison matrix size. This value has been set to the maximum allowed # under 32 bit operating systems. It is not advised to make this value > # than 10000. If you have a machine with very low physical memory you may # want to use a value of 6000 to 7000 where 10000 should be a maximum. # When file lengths exceed the matrix limits, the file is segmented to fit # the matrix size. Maximum LCS file size, number of lines : 10000 # Code differential metrics determine lines that are # different in the current baseline compared to the # older baseline. This metric can include # lines that are removed from the current baseline. Add removed older lines as modified : No # When showing differential details for each file # using the switch -ws Show equal lines : Yes Show lines removed from older file : Yes Show lines added (mod) to newer file : Yes # The following parameter, when set to Yes will cause # the files stored into work files to be relative to the # location specified by the -w"create top_dir", baseline # top directory. Relative Work Files : Yes # User defined productivity values for determining works # rates for baseline metric differentials. Work Seconds per Hour : 3600 Work Hours per Shift : 8 Work Shifts per Day : 1 Work Days per Week : 5 Work Hours per Man Day : 8 Work Hours per Man Week : 40 Work Hours per Man Month : 160 Work Hours per Man Year : 1960 ##################################################################### # Function point conversion factors for LOC metrics # Header File Function Points per LOC : 0 Header File Function Points per eLOC : 0 Header File Function Points per lLOC : 0 C File Function Points per LOC : 128 C File Function Points per eLOC : 128 C File Function Points per lLOC : 128 C++ File Function Points per LOC : 53 C++ File Function Points per eLOC : 53 C++ File Function Points per lLOC : 53 Java File Function Points per LOC : 53 Java File Function Points per eLOC : 53 Java File Function Points per lLOC : 53 C# File Function Points per LOC : 53 C# File Function Points per eLOC : 53 C# File Function Points per lLOC : 53 Other File Function Points per LOC : 0 Other File Function Points per eLOC : 0 Other File Function Points per lLOC : 0 #################################################################### # RSM Configuration for cyclomatic complexity ###################### # # McCabe Cyclomatic Complexity includes the following constructs in # the calculation. # function call + if + inline if + while + for + foreach # case + goto + logical or + Logical and # # You may tailor the cyclomatic complexity calculation to meet your # specific requirements. Include 'function call' in cyclomatic complexity: Yes Include 'while' in cyclomatic complexity : Yes Include 'for' in cyclomatic complexity : Yes Include 'switch' in cyclomatic complexity : No Include 'case' in cyclomatic complexity : Yes Include 'if' in cyclomatic complexity : Yes Include 'else' in cyclomatic complexity : No Include '?' inlined if in cyclomatic complexity : Yes Include 'goto' in cyclomatic complexity : Yes Include '||' or 'or' in cyclomatic complexity : Yes Include '&&' or 'and' in cyclomatic complexity : Yes #################################################################### # RSM Quality Notices Configuration ################################ # User Defined Quality Notices UDQN # Specify the file name which contains the UDQN definitions # See this provided example for a tutorial on UDQN. RSM user defined quality notice file : rsm_udqn.cfg # Re-order the quality notice format so that if a line number # is emitted, the line number precedes the notice number. This # option enables code editors to parse the notice line. Reorder notice, line in quality notices : No # RSM Quality Notices For Code Style ################################### # Quality Notice No. 1 # Emit a quality notice when the physical line length # is greater than the specified number of characters. Quality Notice 1 : Yes Maximum Line Length : 80 # Quality Notice No. 2 # Emit a quality notice when the function name length # is greater than the specified number of characters. Quality Notice 2 : Yes Maximum Function Name Length : 32 # Quality Notice No. 21 # Emit a quality notice when a file does not contain # the specified key string. Quality Notice 21 : No RSM KEY String : # RSM Quality Notices For Stability and Maintainability ################ # Quality Notice No. 3 # Emit a quality notice when ellipsis '...' are identified # within a functions parameter list thus enabling variable # arguments. Quality Notice 3 : Yes # Quality Notice No. 4 # Emit a quality notice if there exists an assignment # operator '=' within a logical 'if' condition. Quality Notice 4 : Yes # Quality Notice No. 5 # Emit a quality notice if there exists an assignment # operator '=' within a logical 'while' condition. Quality Notice 5 : Yes # Quality Notice No. 6 # Emit a quality notice when a pre-decrement operator '--' # is identified within the code. Quality Notice 6 : No # Quality Notice No. 7 # Emit a quality notice when a pre-increment operator '++' # is identified within the code. Quality Notice 7 : No # Quality Notice No. 8 # Emit a quality notice when the 'realloc' function # is identified within the code. Quality Notice 8 : Yes # Quality Notice No. 9 # Emit a quality notice when the 'goto' function # is identified within the code. Quality Notice 9 : Yes # Quality Notice No. 10 # Emit a quality notice when the Non-ANSI function # prototype is identified within the code. Quality Notice 10 : Yes # Quality Notice No. 11 # Emit a quality notice when open and closed brackets # '[ ]' are not balance within a file. Quality Notice 11 : Yes # Quality Notice No. 12 # Emit a quality notice when open and closed parenthesis # '()' are not balance within a file. Quality Notice 12 : Yes # Quality Notice No. 13 # Emit a quality notice when a 'switch' statement does # not have a 'default' condition. Quality Notice 13 : Yes # Quality Notice No. 14 # Emit a quality notice when there are more 'case' conditions # than 'break' statements or 'fall through' comments. Use default in case/break comparison : Yes Quality Notice 14 : Yes # Quality Notice No. 15 # Emit a quality notice when a friend class # is identified within the code. Quality Notice 15 : Yes # Quality Notice No. 22 # Emit a quality notice when each if, else, for # or while is not bound by scope. Quality Notice 22 : Yes # Quality Notice No. 23 # Emit a quality notice when the '?' or the implied # if-then-else construct has been identified. Quality Notice 23 : Yes # Quality Notice No. 24 # Emit a quality notice when an ANSI C++ keyword # is identified within a *.c or a *.h file. Quality Notice 24 : Yes # Quality Notice No. 26 # Emit a quality notice when a void * is identified # within a source file. Quality Notice 26 : No # Quality Notice No. 27 # Emit a quality notice when the number of function # return points is greater than the specified maximum. Quality Notice 27 : Yes Maximum functional return points : 1 Count goto as a function return point : Yes # Quality Notice No. 28 # Emit a quality notice when the cyclomatic complexity # of a function exceeds the specified maximum. Quality Notice 28 : Yes Maximum functional cyclomatic complexity: 10 # Quality Notice No. 29 # Emit a quality notice when the number of function # input parameters exceeds the specified maximum. Quality Notice 29 : Yes Maximum functional interface complexity : 6 # Quality Notice No. 49 # Emit a quality notice when function parameters # are blank or not specified, thus requiring void. Quality Notice 49 : Yes # Quality Notice No. 30 # Emit a quality notice when a TAB character is identified # within the source code. Indentation with TAB will create # editor and device dependent formatting. Quality Notice 30 : Yes # Quality Notice No. 32 # Emit a quality notice when 'using namespace' # has been identified in a C++ source file. Quality Notice 32 : Yes # Quality Notice No. 33 # Emit a quality notice when a class/struct definition # is identified within a function definition. Quality Notice 33 : Yes # Quality Notice No. 34 # Emit a quality notice when a class definition # contains a pointer to a data item. Quality Notice 34 : Yes # Quality Notice No. 35 # Emit a quality notice when a class definition # contains public data. Quality Notice 35 : Yes # Reference Quality Notice No. 35 # Ignore public data for specific types of data Ignore public event data : Yes Ignore public const data : Yes Ignore public delegate data : Yes # Quality Notice No. 36 # Emit a quality notice when a class definition # contains protected data. Quality Notice 36 : Yes # Quality Notice No. 37 # Emit a quality notice when a base class, with virtual # functions, does not contain a virtual destructor. Quality Notice 37 : Yes # Quality Notice No. 38 # Emit a quality notice when exception handling is # present within a function. Quality Notice 38 : Yes # Quality Notice No. 39 # Emit a quality notice when the number of class/struct methods # exceed the specified maximum (public, protected and private). Quality Notice 39 : Yes Maximum number of methods per class : 100 # Quality Notice No. 40 # Emit a quality notice when the depth of the inheritance # tree exceeds the specified maximum value. Quality Notice 40 : Yes Maximum depth of inheritance tree : 4 # Quality Notice No. 41 # Emit a quality notice when the number of direct derived # classes exceeds the specified maximum value. Quality Notice 41 : Yes Maximum number of derived child classes : 10 # Quality Notice No. 42 # Emit a quality notice when the multiple inheritance # has been identified. Quality Notice 42 : Yes # Quality Notice No. 43 # Emit a quality notice when the keyword 'continue' # has been identified. Quality Notice 43 : Yes # Quality Notice No. 44 # Emit a quality notice when the keyword 'break' # has been identified outside a 'switch' logic # control structure. Quality Notice 44 : Yes # Quality Notice No. 45 # Emit a quality notice when a file does not # have equal counts of new and delete. Quality Notice 45 : Yes # Quality Notice No. 50 # Emit a quality notice when a variable is assigned # to a literal number and not a symbolic constant. Quality Notice 50 : No Include zero (0) as literal assignment : No # Quality Notice No. 55 # Emit a quality notice when the depth of scope # exceeds the specified maximum value. This condition # indicates complex logic and/or a maintenance concern. Quality Notice 55 : Yes Maximum depth of scope : 6 # Quality Notice No. 56 # Emit a quality notice when sequential breaks are # identified without a respective case statement. Quality Notice 56 : Yes # RSM Quality Notices for Functional/Struct and Class Content ########## # Minimum LOC for content analysis for blank lines # comments, and white space. Min. Function LOC for content analysis : 5 Min. Class/Struct LOC content analysis : 10 # Quality Notice No. 16 # Emit a quality notice when function, struct, class # or interface white space percentage is less than # the specified minimum. Quality Notice 16 : Yes Minimum Function Whitespace Percent : 10.00 # Quality Notice No. 17 # Emit a quality notice when function comment line # percentage is less than the specified minimum. Quality Notice 17 : No Minimum Function Comment Line Percent : 10.00 # Quality Notice No. 18 # Emit a quality notice when the eLOC within a # function exceeds the specified maximum. Quality Notice 18 : Yes Maximum Function eLOC : 200 # Quality Notice No. 48 # Emit a quality notice when the lLOC within a # function does not meet the specified minimum. # This notice serves to find nop functions. Quality Notice 48 : Yes Minimum Function lLOC : 0 # Quality Notice No. 31 # Emit a quality notice when class/struct comment line # percentage is less than the specified minimum. Quality Notice 31 : Yes Minimum Class/Struct Comment Percent : 10.00 # Quality Notice No. 46 # Emit a quality notice when function, struct, class # or interface blank line percentage is less than the # specified minimum. Quality Notice 46 : No Minimum Function Blank Line Percent : 10.00 # Quality Notice No. 51 # Emit a quality notice when a function # does not have a preceding comment. Quality Notice 51 : Yes # Quality Notice No. 52 # Emit a quality notice when a class # does not have a preceding comment. Quality Notice 52 : Yes # Quality Notice No. 53 # Emit a quality notice when a struct # does not have a preceding comment. Quality Notice 53 : Yes # Quality Notice No. 54 # Emit a quality notice when a interface # does not have a preceding comment. Quality Notice 54 : Yes # RSM Quality Notices for File Content # # Quality Notice No. 19 # Emit a quality notice when file white space # percentage is less than the specified minimum. # Consider setting Notice 30 to No. Quality Notice 19 : Yes Minimum File Whitespace Percent : 10.00 A TAB is equivalent to n space : 2 # Quality Notice No. 20 # Emit a quality notice when file comment line # percentage is less than the specified minimum. Quality Notice 20 : Yes Minimum File Comment Line Percent : 10.00 # Quality Notice No. 47 # Emit a quality notice when file blank line # percentage is less than the specified minimum. Quality Notice 47 : No Minimum File Blank Line Percent : 10.00 # Quality Notice No. 57 # Emit a quality notice when RSM skip lines conditions # are met by a matching token. Quality Notice 57 : No # Quality Notice No. 58 # Emit a quality notice when RSM skip quality notice conditions # are met by a matching token. Quality Notice 58 : No # RSM Quality Notices Miscellaneous #################################### # Quality Notice No. 25 # Deprecated in Version 6.70 # See settings under language extensions. #################################################################### # Code Listing Report Configuration ################################ # The following parameters setup source code printing. # These values become the default settings. Printed Line Length : 80 Printed Page Length : 55 Printed Left Margin : 5 Printed Top Margin : 1 Printed Page Header : RSM Code Listing Page breaks in code print format : No #################################################################### # HTML Report and Color Configuration ############################## # The following parameters setup HTML report output. The hyperlinks # for source code can be either absolute or relative. Relative HTML Links : No # The following color parameters modify the HTML report # output. Colors can be specified as Hex or Name. # Blank color parameters will result to the browser default. HTML RSM Color : #0000FF HTML Date Color : #0000FF HTML Text Color : #000000 HTML VLink Color : #660099 HTML Link Color : #0000EE HTML Background Color : #F8F8F8 HTML Error Color : #FF0000 HTML Line Color : #003399 HTML Old File Differential Color : #CC0033 HTML New File Differential Color : #336666 HTML File Name Color : #0000FF HTML Function Color : #0000FF HTML Function Parameter Color : #006600 HTML Template Color : #006699 HTML Macro Color : #33CCFF HTML Class Color : #663300 HTML Inheritance Color : #FF3300 HTML Struct Color : #990000 HTML Notice Color : #CC0000 HTML Header Color : #993300 HTML New Code Differential Color : #3366CC HTML Removed Code Differential Color : #FF0000 HTML Modified Code Differential Color : #993300 HTML Equal Code Differential Color : #00CC00 HTML Total Color : #993300 HTML Inheritance Depth Color : #333300 HTML Inheritance Child Color : #CC6600 #################################################################### # end of rsm.cfg ================================================ FILE: doxygen/snippets/qepn_qhist.c ================================================ typedef struct { QHsm super; /* inherit QHsm */ QStateHandler hist_doorClosed; /* history of doorClosed */ } ToastOven; /*..........................................................*/ static QState ToastOven_doorClosed(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { ~ ~ ~ case Q_EXIT_SIG: { me->hist_doorClosed = QHsm_state(&me->super); status_ = Q_HANDLED(); break; } } return status_; } /*..........................................................*/ static QState ToastOven_doorOpen(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { ~ ~ ~ case CLOSE_SIG: { status_ = Q_TRAN_HIST(hist_doorClosed); /*<== */ break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } ================================================ FILE: doxygen/snippets/qepn_qhsm.c ================================================ typedef struct { QHsm super; /* inherits QHsm */ double operand1; double operand2; char display[DISP_WIDTH + 1]; uint8_t len; uint8_t opKey; } Calc; ================================================ FILE: doxygen/snippets/qepn_qhsm_ctor.c ================================================ void Alarm_ctor(Alarm * const me) { QHsm_ctor(&me->super, Q_STATE_CAST(&Alarm_initial)); } ================================================ FILE: doxygen/snippets/qepn_qhsm_use.c ================================================ #include "qpn.h" /* QP-nano */ #include "calc.h" /* Application interface */ Q_DEFINE_THIS_FILE static Calc l_calc; /* an instance of Calc HSM */ int main() { Calc_ctor(&l_calc); /* Calc HSM "constructor" invokes QHsm_ctor() */ QHSM_INIT(&l_calc.super); /* trigger initial transition, late biniding */ for (;;) { /* event loop */ . . . /* wait for the next event and assign it to the current event */ QSIG(&l_calc) = ... QPAR(&l_calc) = ... QHSM_DISPATCH(&l_calc.super); /* dispatch the event, late binding */ } return 0; } ================================================ FILE: doxygen/snippets/qepn_qinit.c ================================================ /*..........................................................................*/ void Pelican_ctor(Pelican * const me) { QActive_ctor(me, Q_STATE_CAST(&Pelican_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Pelican_initial(Pelican * const me) { /* the initial pseudo-state */ return Q_TRAN(&Pelican_operational); } /*..........................................................................*/ QState Pelican_operational(Pelican * const me) { /* a regular state handler */ QState status_; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsEnabled); /* regular transition */ break; } case OFF_SIG: { status_ = Q_TRAN(&Pelican_offline); /* regular transition */ break; } default: { status_ = Q_SUPER(&QHsm_top); /* the superstate */ break; } } return status_; } ================================================ FILE: doxygen/snippets/qepn_qtran.c ================================================ /* HSM definition ----------------------------------------------------------*/ QState Pelican_carsGreenNoPed(Pelican * const me) { QState status_; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_showState(me->super.prio, "carsGreenNoPed"); status_ = Q_HANDLED(); break; } case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsGreenPedWait); break; } case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenInt); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*..........................................................................*/ QState Pelican_carsGreenPedWait(Pelican * const me) { QState status_; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_showState(me->super.prio, "carsGreenPedWait"); status_ = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } ================================================ FILE: doxygen/snippets/qfn_armx.c ================================================ /* when #QF_TIMEEVT_PERIODIC is NOT defined... */ QState Pelican_carsGreen(Pelican * const me) { QState status_; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { /* arm timer (one-shot) at tick rate 0 */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT); BSP_signalCars(CARS_GREEN); status_ = Q_HANDLED(); break; } case Q_EXIT_SIG: { QActive_disarm(&me->super) status_ = Q_HANDLED(); break; } case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenNoPed); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /* when #QF_TIMEEVT_PERIODIC is defined... */ QState Pelican_carsGreen(Pelican * const me) { QState status_; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { /* arm timer (one-shot) at tick rate 0 */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); BSP_signalCars(CARS_GREEN); status_ = Q_HANDLED(); break; } case Q_EXIT_SIG: { QActive_disarm(&me->super) status_ = Q_HANDLED(); break; } case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenNoPed); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } ================================================ FILE: doxygen/snippets/qfn_main.c ================================================ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* Application interface */ /*..........................................................................*/ static QEvt l_pelicanQueue[2]; static QEvt l_pedQueue[1]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0 }, { (QActive *)&AO_Pelican, l_pelicanQueue, Q_DIM(l_pelicanQueue) }, { (QActive *)&AO_Ped, l_pedQueue, Q_DIM(l_pedQueue) } }; /*..........................................................................*/ int_t main (void) { Pelican_ctor(); /* instantiate the Pelican AO */ Ped_ctor(); /* instantiate the Ped AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: doxygen/snippets/qfn_post.c ================================================ /* event posting from the interrupt context (QACTIVE_POST_ISR()) ... */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) { QK_ISR_ENTRY(); /* infrom QK-nano about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* post TIME_TICK events to all interested active objects... */ QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TIME_TICK_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Ship, TIME_TICK_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Missile, TIME_TICK_SIG, 0U); QK_ISR_EXIT(); /* infrom QK-nano about exiting an ISR */ } /* event posting from the task context (QACTIVE_POST())... */ static QState Ship_flying(Ship * const me) { QState status_; switch (Q_SIG(me)) { case TIME_TICK_SIG: { . . . if ((me->score % 10) == 0) { /* is the score "round"? */ QACTIVE_POST((QActive *)&AO_Tunnel, SCORE_SIG, me->score); /* signal and parameter */ } status_ = Q_HANDLED(); break; } . . . } return status_; } ================================================ FILE: doxygen/snippets/qfn_postx.c ================================================ /* "extended" event posting from the interrupt context (QACTIVE_POST_X_ISR) */ void SysTick_Handler(void) { . . . if (!QACTIVE_POST_X_ISR((QActive *)&AO_Cruncher, 5U, /* margin of free slots in the queue */ ECHO_SIG, 0U)) /* signal and parameter */ { /* event posting failed... */ } } /* "extended" event posting from the task context (QACTIVE_POST_X())... */ static QState Ship_flying(Ship * const me) { QState status_; switch (Q_SIG(me)) { case TIME_TICK_SIG: { . . . if ((me->score % 10) == 0) { /* is the score "round"? */ if (!QACTIVE_POST_X((QActive *)&AO_Tunnel, 4U, /* margin of free slots in the queue */ SCORE_SIG, me->score)) /* signal and parameter */ { /* event posting failed... */ } } status_ = Q_HANDLED(); break; } . . . } return status_; } ================================================ FILE: doxygen/snippets/qfn_qactive.c ================================================ /* PEdestrian Light CONtrolled (PELICAN) crossing active object */ typedef struct { QActive super; /* inherits QActive */ uint8_t pedFlashCtr; /* pedestrian flash counter */ } Pelican; /* the ctor */ void Pelican_ctor(Pelican * const me, uint8_t timeout) { /* call the superclass' ctor... */ QActive_ctor(&me->super, Q_STATE_CAST(&Pelican_initial)); . . . /* initialize the added attributes */ } ================================================ FILE: doxygen/snippets/qfn_tickx.c ================================================ /* system clock tick ISR for MSP430 from TI (cooperative QV-nano kernel) */ #pragma vector = TIMERA0_VECTOR __interrupt void timerA_ISR(void) { __low_power_mode_off_on_exit(); QF_tickXISR(0U); /* handle all armed time events at tick rate 0 */ } /* system clock tick ISR for MSP430 from TI (preemptive QK-nano kernel) */ #pragma vector = TIMERA0_VECTOR __interrupt void timerA_ISR(void) { QK_ISR_ENTRY(); /* inform QK-nano about entering the ISR */ QF_tickXISR(0U); /* handle all armed time events at tick rate 0 */ QK_ISR_EXIT(); /* inform QK-nano about exiting the ISR */ } ================================================ FILE: doxygen/snippets/qkn_lock.c ================================================ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ uint32_t rnd; QSchedStatus lockStat; /* <=== QK-nano scheduler lock status */ lockStat = QK_schedLock(N_PHILO); /* <=== lock scheduler up to N_PHILO prio */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ rnd = l_rnd * (3U*7U*11U*13U*23U); l_rnd = rnd; /* set for the next time */ QK_schedUnlock(lockStat); /* <=== unlock the scheduler */ return (rnd >> 8); } ================================================ FILE: doxygen/snippets/qkn_oncontextsw.c ================================================ #ifdef QK_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ void QK_onContextSw(uint_fast8_t prev, uint_fast8_t next) { (void)prev; if (next != (uint_fast8_t)0) { //_impure_ptr = &reentrant[next]; } } #endif /* QK_ON_CONTEXT_SW */ ================================================ FILE: doxygen/struct.dox ================================================ /*! @page struct Structure and Features @tableofcontents @section files Directories and Files The following annotated directory tree lists the top-level directories provided in the standard QP-nano distribution.
  • qpn/
    • 3rd_party/ — Third-Party code used in the QP-nano @ref ports "ports" and @ref exa "examples"
    • examples/ — @ref exa "QP-nano Examples"
    • ports/ — @ref ports "QP-nano Ports"
    • include/ — Platform-independent QP-nano API (see @ref ../include "include")
    • src/ — Platform-independent QP-nano source code (see @ref ../src "src")
@note The standard QP-nano distribution contains many @ref exa "Example Projects", which are specifically designed to help you learn to use QP-nano and to serve you as starting points for your own projects. @section comp Components of QP-nano The QP-nano active object framework is comprised of the following components: @image html qpn_components.jpg "Components of the QP-nano Framework" @subsection comp_qep QEP-nano Hierarchical Event Processor QEP-nano is a universal, UML-compliant event processor that enables developers to code UML state machines in highly readable ANSI-C, in which every state machine element is mapped to code precisely, unambiguously, and exactly once (traceability). QEP-nano fully supports hierarchical state nesting, which is the fundamental mechanism for reusing behavior across many states instead of repeating the same actions and transitions over and over again. (See also @ref qepn). @subsection comp_qf QF-nano Active-Object Framework QF-nano is a portable, event-driven, active-object (actor) framework for execution of **active objects** (concurrent state machines) specifically designed for real-time embedded (RTE) systems. (See also @ref qfn). @subsection comp_qv QV-nano Cooperative Kernel QV-nano is a simple **cooperative** kernel (previously called "Vanilla" kernel). This kernel executes active objects one at a time, with priority-based scheduling performed before processing of each event. Due to naturally short duration of event processing in state machines, the simple QV kernel is often adequate for many real-time systems. (See also @ref qvn). @subsection comp_qk QK-nano Preemptive Kernel QK-nano is a tiny **preemptive**, priority-based, non-blocking, real-time kernel designed specifically for executing active objects. QK-nano meets all the requirement of the Rate Monotonic Scheduling (a.k.a. Rate Monotonic Analysis — RMA) and can be used in hard real-time systems. (See also @ref qkn). @section classes Classes in QP-nano The figure below shows the main classes comprising the QP-nano framework and their relation to the application-level code, such as the @ref game example application. @image html qpn_classes.gif "Main Classes in the QP-nano Framework"
  • 0 The ::QEvt class represents events, possibly with a parameter (the existence of event parameter is configured by the macro #Q_PARAM_SIZE).
  • 1 The abstract ::QHsm class represents a Hierarchical State Machine (HSM) with full support for hierarchical nesting of states, entry/exit actions, initial transitions, and transitions to history in any composite state. This class is designed for ease of manual coding of HSMs in C, but it is also supported by the QM modeling tool. The class is abstract, meaning that it is not designed to be instantiated directly, but rather only for inheritance. The @ref game application provides an example of application-level classes deriving directly from ::QHsm (see [5]).
  • 2 The abstract ::QActive class represents an active object that uses the ::QHsm style state machine implementation strategy. This strategy is tailored to manual coding, but it is also supported by the QM modeling tool. The @ref game application provides an example of application-level classes deriving directly from ::QActive (see [4]).
  • 3 ::QActiveCB (QActive Control Block) represents the read-only (constant) information that the QF-nano needs to manage the active object. ::QActiveCB objects are grouped in the array ::QF_active, which typically can be placed in ROM.
  • 4 Active Objects in the application derive from the ::QActive base class.
  • 5 Applications can also use classes derived directly from the ::QHsm base class to represent "raw" state machines that are not active objects, because they don't have event queue and execution thread. Such "raw" state machines are typically used as "Orthogonal Components".
@section sm State Machines The behavior of each active object in QP-nano is specified by means of a hierarchical state machine (UML statechart), which is the most effective and elegant technique of describing event-driven behavior. The most important innovation of UML state machines over classical finite state machines (FSMs) is the hierarchical state nesting. The value of state nesting lies in avoiding repetitions, which are inevitable in the traditional "flat" FSM formalism and are the main reason for the "state-transition explosion" in FSMs. The semantics of state nesting allow substates to define only the differences of behavior from the superstates, thus promoting sharing and reusing behavior. @htmlonly
Application Note: A Crash Course in UML State Machines
@endhtmlonly The Quantum Leaps Application Note A Crash Course in UML State Machines introduces the main state machine concepts backed up by examples.
@note The hallmark of the QP-nano implementation of UML state machines is **traceability**, which is direct, precise, and unambiguous mapping of every state machine element to human-readable, portable, MISRA-compliant C code. Preserving the traceability from requirements through design to code is essential for mission-critical systems, such as medical devices or avionic systems. @section coding Coding Standard The QP-nano framework has been developed in strict adherence to the documented Quantum Leaps Coding Standard. @htmlonly
Application Note: Quantum Leaps C/C++ Coding Standard
@endhtmlonly @section misra MISRA Compliance

The QP-nano framework complies with most of the Motor Industry Software Reliability Association (MISRA) MISRA-C:2004 rules.

@htmlonly
Application Note: QP-nano MISRA-C:2004 Compliance Matrix
@endhtmlonly All deviations are carefully limited into very specific contexts and are documented with the Application Note: QP-nano MISRA-C:2004 Compliance Matrix. @note MISRA and MISRA C are registered trademarks of MIRA Ltd, held on behalf of the MISRA Consortium. The MISRA guidelines place great emphasis on the use of static code analysts tools to check compliance with the MISRA-C language subset. To this end, QP-nano comes with an extensive support for automatic rule checking with @ref lint "PC-Lint". The QP frameworks go even beyond MISRA, by complying with the strict type checking of PC-Lint. @section pc-lint PC-Lint Support The QP-nano framework comes with extensive support for automatic rule checking by means of PC-Lint, which is designed not just for proving compliance of the QP-nano framework code, but more importantly, to aid in checking compliance of the application-level code. Any organization engaged in designing safety-related embedded software could benefit from the unprecedented quality infrastructure built around the QP-nano framework. @sa @ref lint "Lint Port" */ /*##########################################################################*/ /*! @dir ../include Platform-independent QP-nano API @note The QP-nano include directory needs to be added to the compiler's include path in the applications using QP-nano. */ /*##########################################################################*/ /*! @dir ../src Platform-independent QP-nano source code Files from this directory need to be added to the project, to build the QP-nano framework from source code. @note The QP-nano src directory needs to be added to the compiler's include path in the applications that build QP-nano framework from sources (as opposed to using QP as a pre-built library). */ /*##########################################################################*/ /*! @dir ../src/qfn Platform-independent implementation of the @ref qepn and @ref qfn components. @note Typically, files in this directory need to be added to the application build, but some QP ports might not need all the files in this directory. For example, a QP port to a 3rd-party RTOS kernel might be using a message queue of the RTOS instead of the native QP event queue, in which case the file qf_actq.c would not be needed and should be excluded from the build. */ /*##########################################################################*/ /*! @dir ../src/qvn Platform-independent implementation of the @ref qvn built-in kernel. @attention Files in this directory need to be included in the QP application build only if the application uses the @ref qvn kernel. */ /*##########################################################################*/ /*! @dir ../src/qkn Platform-independent implementation of the @ref qkn built-in kernel. @attention Files in this directory need to be included in the QP application build only if the application uses the @ref qkn kernel. */ ================================================ FILE: examples/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/exa.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/exa_arm-cm.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/README.txt ================================================ About this Example ================== This directory contains a QP example application for the EFM32-SLSTK3401A board (Pearl Gecko Starter Kit). This directory contains portable code that should compile with any C compiler for ARM Cortex-M. The sub-directories contain code and project files, which are specific to the particular ARM toolchains, such as ARM (MDK-ARM), GNU, and IAR. Please refer to the README files in the sub-directories for specific instructions how to use and customize the example to your needs. Support Code for EFM32-SLSTK3401A Board ======================================= The directory qpc\3rd_party\efm32pg1b contains the CMSIS-compliant device code for the EFM32PG1B200F256GM48 MCU. Please see the README.txt file in this folder for more details. Win32-QV Emulation ================== The sub-directory win32-qv provides the emulation of the example on Windows GUI (with the cooperative QV scheduler). This sub-directory contains the Makefile for the MinGW toolset and Visual Studio solution file (game-gui.sln) for Visual C++. The Win32-QV emulation uses exactly the same code as the embedded board and differ only in the Board Support Package (bsp.c). This example demonstrates the "dual targeting" development approach, where most of the embedded code is developed on the desktop machine (Windows), but is intended for a deeply embedded target (EFM32-SLSTK3401A here). ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_blinky_ek-tm4c123gxl.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/armclang/blinky-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 1 5 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 efm32pg1b 1 0 0 0 2 6 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 8 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 13 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 17 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 18 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/armclang/blinky-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qk.bin .\dbg\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c blinky-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ blinky-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qk.bin .\rel\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on EFM32-SLSTK3401A board, preemptive QK kernel * Last Updated for Version: 5.6.5 * Date of the Last Update: 2016-06-02 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... */ #if 1 /* OPTION 1: * Use the automatic FPU state preservation and the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in more than one task or * in any ISRs. This setting is the safest and recommended, but requires * extra stack space and CPU cycles. */ FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else /* OPTION 2: * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in ONE task only and not * in any ISR. This setting is very efficient, but if more than one task * (or ISR) start using the FPU, this can lead to corruption of the * FPU registers. This option should be used with CAUTION. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); } /*..........................................................................*/ void BSP_ledOff(void) { //GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } /*..........................................................................*/ void BSP_ledOn(void) { /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; //GPIO_PinOutSet(LED0_PORT, LED0_PIN); GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED1 on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains two build configurations: Debug (default) and Release. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: qpc\3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/blinky-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * http://www.state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/blinky-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/blinky-qk.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\..\..\..\include\qstamp.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/blinky-qk.eww ================================================ $WS_DIR$\blinky-qk.ewp ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qk/iar/blinky-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/armclang/blinky-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 0 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 1 5 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 efm32pg1b 1 0 0 0 2 6 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 8 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 13 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 17 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 18 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/armclang/blinky-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qv.bin .\dbg\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c blinky-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ blinky-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qv.bin .\rel\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on EFM32-SLSTK3401A board, cooperative QV kernel * Last Updated for Version: 5.6.5 * Date of the Last Update: 2016-06-02 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... * * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used only by active objects * and NOT in any ISR. This setting is very efficient, but if any ISRs * start using the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); } /*..........................................................................*/ void BSP_ledOff(void) { //GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } /*..........................................................................*/ void BSP_ledOn(void) { /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; //GPIO_PinOutSet(LED0_PORT, LED0_PIN); GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE01 */ /* toggle LED1 on and then off, see NOTE02 */ GPIO_PinOutSet(LED_PORT, LED1_PIN); //GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); //GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := \ LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains two build configurations: Debug (default) and Release. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: qpc\3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/gnu/blinky-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * http://www.state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/iar/blinky-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/iar/blinky-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\..\..\..\include\qstamp.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/iar/blinky-qv.eww ================================================ $WS_DIR$\blinky-qv.ewp ================================================ FILE: examples/arm-cm/blinky_efm32-slstk3401a/qv/iar/blinky-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/README.txt ================================================ About this Example ================== This directory contains the simple "Blinky" QP-nano example application for the EK-TM4C123GXL board (TivaC LauchPad). This directory contains portable code that should compile with any C compiler. The sub-directories contain the Board Support Packages (BSPs) for the preemptive QK-nano kernel (sub-directory qk), the cooperative QV kernel (sub-directory qv), and the Win32-QV emulation (Windows). The native kernels (QK-nano and QV-nano) further provide code and project files for the particular ARM toolchains, such as ARM (MDK-ARM), GNU, and IAR. Please refer to the README files in the sub-directories for instructions how to use and customize the example to your needs. Support Code for EK-TM4C123GXL Board ==================================== The directory qpn\3rd_party\ek-tm4c123gxl contains the CMSIS-compliant device code for the TM4C123GH6PM MCU. Please see the README.txt file in this folder for more details. Win32 Emulation =============== The sub-directory win32-qv provides the emulation of the example on Windows as a console application. The sub-directory contains the Makefile for the MinGW toolset and a Visual Studio solution file (blinky.sln) for Visual C++. The Win32 emulation uses exactly the same code as the embedded board and differs only in the Board Support Package (bsp.c). This example demonstrates the "dual targeting" development approach, where most of the embedded code is developed on the desktop machine (Windows), but is intended for a deeply embedded target (TivaC LauchPad here). ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_blinky_ek-tm4c123gxl.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/arm/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/arm/blinky-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 3 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 ek-tm4c123gxl 1 0 0 0 2 5 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 6 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 7 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 15 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/arm/blinky-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 5060750::V5.06 update 6 (build 750)::ARMCC 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qk.bin .\dbg\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 1 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c blinky-rel 0x4 ARM-ADS 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ blinky-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qk.bin .\rel\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 4 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/armclang/blinky-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 ek-tm4c123gxl 1 0 0 0 2 5 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 6 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 7 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 15 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 16 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/armclang/blinky-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qk.bin .\dbg\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 0 0 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c blinky-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ blinky-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qk.bin .\rel\blinky-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on EK-TM4C123GXL board, preemptive QK kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... */ #if 1 /* OPTION 1: * Use the automatic FPU state preservation and the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in more than one task or * in any ISRs. This setting is the safest and recommended, but requires * extra stack space and CPU cycles. */ FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else /* OPTION 2: * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in ONE task only and not * in any ISR. This setting is very efficient, but if more than one task * (or ISR) start using the FPU, this can lead to corruption of the * FPU registers. This option should be used with CAUTION. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); } /*..........................................................................*/ void BSP_ledOff(void) { GPIOF->DATA_Bits[LED_GREEN] = 0U; } /*..........................................................................*/ void BSP_ledOn(void) { /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; GPIOF->DATA_Bits[LED_GREEN] = 0xFFU; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.ccsproject ================================================ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/.project ================================================ blinky-qk org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QK-nano 2 PARENT-5-PROJECT_LOC/src/qkn QP-nano 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qk/gnu TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/TM4C123GH6PM.h blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h gpio.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gpio.h main.c 1 PARENT-2-PROJECT_LOC/main.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c rom.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/rom.h startup_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gnu/startup_TM4C123GH6PM.c sysctl.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/sysctl.h system_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.c system_TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.h ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QK-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := -DTARGET_IS_TM4C123_RB1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/README.txt ================================================ About this Example ================== This example can be built in two different ways: - from the command prompt with the provided Makefile. - from the TI Code Composer Studio with the provided CCS project. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/blinky-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/iar/blinky-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/iar/blinky-qk.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/iar/blinky-qk.eww ================================================ $WS_DIR$\blinky-qk.ewp ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qk/iar/blinky-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/arm/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/arm/blinky-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 3 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 ek-tm4c123gxl 1 0 0 0 2 5 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 6 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 7 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 15 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/arm/blinky-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 5060020::V5.06 (build 20)::ARMCC TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qv.bin .\dbg\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 1 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c blinky-rel 0x4 ARM-ADS TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ blinky-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qv.bin .\rel\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 4 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/armclang/blinky-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 blinky-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blinky-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 3 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\blinky.c blinky.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\blinky.h blinky.h 0 0 ek-tm4c123gxl 1 0 0 0 2 5 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 6 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 7 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 15 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/armclang/blinky-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
blinky-dbg 0x4 ARM-ADS 5060020::V5.06 (build 20)::ARMCC 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ blinky-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\blinky-qv.bin .\dbg\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 1 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c blinky-rel 0x4 ARM-ADS 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ blinky-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\blinky-qv.bin .\rel\blinky-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 4 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 blinky-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c blinky.c 1 ..\..\blinky.c main.c 1 ..\..\main.c blinky.h 5 ..\..\blinky.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c
================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on EK-TM4C123GXL board, cooperative QV kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used at the task-level only and * NOT in any ISR. This setting is very efficient, but if ISRs start using * the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); } /*..........................................................................*/ void BSP_ledOff(void) { GPIOF->DATA_Bits[LED_GREEN] = 0U; } /*..........................................................................*/ void BSP_ledOn(void) { /* exercise the FPU with some floating point computations */ float volatile x = 3.1415926F; x = x + 2.7182818F; GPIOF->DATA_Bits[LED_GREEN] = 0xFFU; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE01 */ /* toggle LED2 on and then off, see NOTE02 */ GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.ccsproject ================================================ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/.project ================================================ blinky-qv org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature qv-nano 2 PARENT-5-PROJECT_LOC/src/qvn QP-nano 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qv/gnu TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/TM4C123GH6PM.h blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h gpio.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gpio.h main.c 1 PARENT-2-PROJECT_LOC/main.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c rom.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/rom.h startup_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gnu/startup_TM4C123GH6PM.c sysctl.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/sysctl.h system_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.c system_TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.h ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QV-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/README.txt ================================================ About this Example ================== This example can be built in two different ways: - from the command prompt with the provided Makefile. - from the TI Code Composer Studio with the provided CCS project. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/blinky-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/iar/blinky-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/iar/blinky-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/iar/blinky-qv.eww ================================================ $WS_DIR$\blinky-qv.ewp ================================================ FILE: examples/arm-cm/blinky_ek-tm4c123gxl/qv/iar/blinky-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/README.txt ================================================ About this Example ================== This directory contains the simple DPP QP-nano example application for the EK-TM4C123GXL board (TivaC LauchPad). This directory contains portable code that should compile with any C compiler. The sub-directories contain the Board Support Packages (BSPs) for the preemptive QK-nano kernel (sub-directory qk), the cooperative QV kernel (sub-directory qv), and the Win32-QV emulation (Windows). The native kernels (QK-nano and QV-nano) further provide code and project files for the particular ARM toolchains, such as ARM (MDK-ARM), GNU, and IAR. Please refer to the README files in the sub-directories for instructions how to use and customize the example to your needs. Support Code for EK-TM4C123GXL Board ==================================== The directory qpn\3rd_party\ek-tm4c123gxl contains the CMSIS-compliant device code for the TM4C123GH6PM MCU. Please see the README.txt file in this folder for more details. Win32 Emulation =============== The sub-directory win32-qv provides the emulation of the example on Windows as a GUI application. The sub-directory contains the Makefile for the MinGW toolset and a Visual Studio solution file (dpp-gui.sln) for Visual C++. The Win32 emulation uses exactly the same code as the embedded board and differs only in the Board Support Package (bsp.c). This example demonstrates the "dual targeting" development approach, where most of the embedded code is developed on the desktop machine (Windows), but is intended for a deeply embedded target (TivaC LauchPad here). Lint Support ============ The sub-directory lint provides the scripts and configuration files for running the PC-Lint static analysis tool over the application code. Please read the README.txt file in the lint directory for more information. ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_dpp_efm32-slstk3401a.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 efm32pg1b 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 8 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 13 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 14 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 17 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 18 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 19 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/armclang/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP example, EFM32-SLSTK3401A board, preemptive QK kernel * Last Updated for Version: 5.9.7 * Date of the Last Update: 2018-08-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIO_EVEN_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIO_EVEN_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & (1U << PB0_PIN)) != 0U) { /* debounced PB0 state changed? */ if ((buttons.depressed & (1U << PB0_PIN)) != 0U) { /* PB0 depressed?*/ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /*..........................................................................*/ void GPIO_EVEN_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QACTIVE_POST_ISR(&AO_Table, MAX_SIG, 0U); QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... */ #if 1 /* OPTION 1: * Use the automatic FPU state preservation and the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in more than one task or * in any ISRs. This setting is the safest and recommended, but requires * extra stack space and CPU cycles. */ FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else /* OPTION 2: * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in ONE task only and not * in any ISR. This setting is very efficient, but if more than one task * (or ISR) start using the FPU, this can lead to corruption of the * FPU registers. This option should be used with CAUTION. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'e') { GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } else { GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != 0U) { GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } else { GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ uint32_t rnd; QSchedStatus lockStat; /* <=== QK scheduler lock status */ /* The flating point code is to exercise the FPU... */ float volatile x = 3.1415926F; x = x + 2.7182818F; lockStat = QK_schedLock(N_PHILO); /* <=== lock scheduler up to N_PHILO prio */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ rnd = l_rnd * (3U*7U*11U*13U*23U); l_rnd = rnd; /* set for the next time */ QK_schedUnlock(lockStat); /* <=== unlock the scheduler */ return (rnd >> 8); } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIO_EVEN_IRQn, GPIO_EVEN_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIO_EVEN_IRQn); } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QK_ISR_ENTRY/QK_ISR_ENTRY * macros or any other QF/QK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF/QK services. In particular they * can NOT call the macros QK_ISR_ENTRY/QK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains two build configurations: Debug (default) and Release. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: qpc\3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/gnu/dpp-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * http://www.state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/iar/dpp-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 29 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 29 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/iar/dpp-qk.ewp ================================================ 3 Debug ARM 1 General 3 30 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 30 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\qpn_conf.h $PROJ_DIR$\..\..\..\..\..\include\qstamp.c $PROJ_DIR$\..\..\table.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qk/iar/dpp-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.9.7 * Date of the Last Update: 2017-08-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #define QK_SCHED_LOCK #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/armclang/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 efm32pg1b 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 8 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 13 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 14 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 17 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 18 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 19 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/armclang/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP example, EFM32-SLSTK3401A board, cooperative QV kernel * Last Updated for Version: 5.6.5 * Date of the Last Update: 2016-05-08 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIO_EVEN_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIO_EVEN_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & (1U << PB0_PIN)) != 0U) { /* debounced PB0 state changed? */ if ((buttons.depressed & (1U << PB0_PIN)) != 0U) { /* PB0 depressed?*/ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /*..........................................................................*/ void GPIO_EVEN_IRQHandler(void) { QACTIVE_POST_ISR(&AO_Table, MAX_SIG, 0U); } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... * * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used only by active objects * and NOT in any ISR. This setting is very efficient, but if any ISRs * start using the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'e') { GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } else { GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != 0U) { GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); } else { GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ uint32_t rnd; /* The flating point code is to exercise the FPU... */ float volatile x = 3.1415926F; x = x + 2.7182818F; /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ rnd = l_rnd * (3U*7U*11U*13U*23U); l_rnd = rnd; return rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIO_EVEN_IRQn, GPIO_EVEN_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIO_EVEN_IRQn); } /*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE01 */ /* toggle LED1 on and then off, see NOTE02 */ GPIO_PinOutSet(LED_PORT, LED1_PIN); //GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); //GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QK_ISR_ENTRY/QK_ISR_ENTRY * macros or any other QF/QK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF/QK services. In particular they * can NOT call the macros QK_ISR_ENTRY/QK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := \ LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains two build configurations: Debug (default) and Release. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: qpc\3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/gnu/dpp-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * http://www.state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/iar/dpp-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/iar/dpp-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\qpn_conf.h $PROJ_DIR$\..\..\..\..\..\include\qstamp.c $PROJ_DIR$\..\..\table.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/qv/iar/dpp-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/bsp.c ================================================ /***************************************************************************** * Product: "DPP" example, EFM32-SLSTK3401A, Win32-GUI * Last Updated for Version: 6.7.0 * Date of the Last Update: 2020-01-06 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "qwin_gui.h" /* QWIN GUI */ #include "resource.h" /* GUI resource IDs generated by the resource editior */ #include "safe_std.h" /* portable "safe" / facilities */ Q_DEFINE_THIS_FILE /* local variables ---------------------------------------------------------*/ static HINSTANCE l_hInst; /* this application instance */ static HWND l_hWnd; /* main window handle */ static LPSTR l_cmdLine; /* the command line string */ static SegmentDisplay l_philos; /* SegmentDisplay to show Philo status */ static OwnerDrawnButton l_pauseBtn; /* owner-drawn button */ static unsigned l_rnd; /* random seed */ /* Local functions ---------------------------------------------------------*/ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam); /*..........................................................................*/ /* thread function for running the application main_gui() */ static DWORD WINAPI appThread(LPVOID par) { (void)par; /* unused parameter */ return (DWORD)main_gui(); /* run the QF application */ } /*--------------------------------------------------------------------------*/ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int iCmdShow) { HWND hWnd; MSG msg; (void)hPrevInst; /* unused parameter */ l_hInst = hInst; /* save the application instance */ l_cmdLine = cmdLine; /* save the command line string */ //AllocConsole(); /* create the main custom dialog window */ hWnd = CreateCustDialog(hInst, IDD_APPLICATION, NULL, &WndProc, "MY_CLASS"); ShowWindow(hWnd, iCmdShow); /* show the main window */ /* enter the message loop... */ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } //FreeConsole(); BSP_terminate(0); return msg.wParam; } /*..........................................................................*/ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { /* Perform initialization upon cration of the main dialog window * NOTE: Any child-windows are NOT created yet at this time, so * the GetDlgItem() function can't be used (it will return NULL). */ case WM_CREATE: { l_hWnd = hWnd; /* save the window handle */ /* initialize the owner-drawn buttons... * NOTE: must be done *before* the first drawing of the buttons, * so WM_INITDIALOG is too late. */ OwnerDrawnButton_init(&l_pauseBtn, IDC_PAUSE, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_UP)), LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_DWN)), LoadCursor(NULL, IDC_HAND)); return 0; } /* Perform initialization after all child windows have been created */ case WM_INITDIALOG: { SegmentDisplay_init(&l_philos, N_PHILO, /* N_PHILO "segments" for the Philos */ 3U); /* 3 bitmaps (for thinking/hungry/eating) */ SegmentDisplay_initSegment(&l_philos, 0U, IDC_PHILO_0); SegmentDisplay_initSegment(&l_philos, 1U, IDC_PHILO_1); SegmentDisplay_initSegment(&l_philos, 2U, IDC_PHILO_2); SegmentDisplay_initSegment(&l_philos, 3U, IDC_PHILO_3); SegmentDisplay_initSegment(&l_philos, 4U, IDC_PHILO_4); SegmentDisplay_initBitmap(&l_philos, 0U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_THINKING))); SegmentDisplay_initBitmap(&l_philos, 1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_HUNGRY))); SegmentDisplay_initBitmap(&l_philos, 2U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_EATING))); /* --> QP: spawn the application thread to run main_gui() */ Q_ALLEGE(CreateThread(NULL, 0, &appThread, NULL, 0, NULL) != (HANDLE)0); return 0; } case WM_DESTROY: { PostQuitMessage(0); return 0; } /* commands from regular buttons and menus... */ case WM_COMMAND: { SetFocus(hWnd); switch (wParam) { case IDOK: case IDCANCEL: { PostQuitMessage(0); break; } } return 0; } /* owner-drawn buttons... */ case WM_DRAWITEM: { LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; switch (pdis->CtlID) { case IDC_PAUSE: { /* PAUSE owner-drawn button */ switch (OwnerDrawnButton_draw(&l_pauseBtn,pdis)) { case BTN_DEPRESSED: { QACTIVE_POST((QActive *)&AO_Table, PAUSE_SIG, 0U); break; } case BTN_RELEASED: { QACTIVE_POST((QActive *)&AO_Table, SERVE_SIG, 0U); break; } default: { break; } } break; } } return 0; } /* mouse input... */ case WM_MOUSEWHEEL: { return 0; } /* keyboard input... */ case WM_KEYDOWN: { return 0; } } return DefWindowProc(hWnd, iMsg, wParam, lParam) ; } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_setTickRate(BSP_TICKS_PER_SEC, 30U); /* set the desired tick rate */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const * const module, int_t loc) { char message[80]; QF_stop(); /* stop ticking */ SNPRINTF_S(message, Q_DIM(message) - 1, "Assertion failed in module %s location %d", module, loc); MessageBox(l_hWnd, message, "!!! ASSERTION !!!", MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL); PostQuitMessage(-1); } /*..........................................................................*/ void BSP_init(void) { } /*..........................................................................*/ void BSP_terminate(int16_t result) { QF_stop(); /* cleanup all QWIN resources... */ OwnerDrawnButton_xtor(&l_pauseBtn); /* cleanup the l_pauseBtn resources */ SegmentDisplay_xtor(&l_philos); /* cleanup the l_philos resources */ /* end the main dialog */ EndDialog(l_hWnd, result); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { UINT bitmapNum = 0; Q_REQUIRE(n < N_PHILO); switch (stat[0]) { case 't': bitmapNum = 0U; break; case 'h': bitmapNum = 1U; break; case 'e': bitmapNum = 2U; break; default: Q_ERROR(); break; } /* set the "segment" # n to the bitmap # 'bitmapNum' */ SegmentDisplay_setSegment(&l_philos, (UINT)n, bitmapNum); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { char buf[16]; LoadString(l_hInst, (paused != 0U) ? IDS_PAUSED : IDS_RUNNING, buf, Q_DIM(buf)); SetDlgItemText(l_hWnd, IDC_PAUSED, buf); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/dpp-gui.sln ================================================ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dpp-gui", "dpp-gui.vcxproj", "{79027B25-0949-4F66-9765-4EFBCBBEFB94}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Debug|Win32.ActiveCfg = Debug|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Debug|Win32.Build.0 = Debug|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Release|Win32.ActiveCfg = Release|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/dpp-gui.vcxproj ================================================ Debug Win32 Release Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94} dpp-gui 10.0 Application false NotSet v142 Application false NotSet v142 <_ProjectFileVersion>10.0.40219.1 $(Configuration)\ $(Configuration)\ false false $(Configuration)\ $(Configuration)\ false false NDEBUG;%(PreprocessorDefinitions) true true Win32 .\Release/dpp-gui.tlb MaxSpeed OnlyExplicitInline .;..;../../../../include;../../../../ports/win32-qv QWIN_GUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) false MultiThreaded true $(IntDir) $(IntDir) $(IntDir) Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 %(AdditionalDependencies) $(OutDir)$(ProjectName).exe true %(AdditionalLibraryDirectories) Windows false MachineX86 true .\Release/dpp-gui.bsc _DEBUG;%(PreprocessorDefinitions) true true Win32 .\Debug/dpp-gui.tlb Disabled .;..;../../../../include;../../../../ports/win32-qv QWIN_GUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) false Default MultiThreaded $(IntDir) $(IntDir) $(IntDir) true Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 %(AdditionalDependencies) $(OutDir)$(ProjectName).exe true %(AdditionalLibraryDirectories) true false Windows false MachineX86 true .\Debug/dpp-gui.bsc ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/dpp-gui.vcxproj.filters ================================================  Res Res Res Res Res Res {382909e6-fb4e-4829-941e-d3461d9ce146} {cead428d-5be7-440c-b491-936bfc2a36a3} QP QP QP ================================================ FILE: examples/arm-cm/dpp_efm32-slstk3401a/win32-gui/resource.h ================================================ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Resource.rc // #define IDI_QP 2 #define IDD_APPLICATION 101 #define IDB_THINKING 134 #define IDB_EATING 135 #define IDB_HUNGRY 136 #define IDB_BTN_UP 137 #define IDB_BTN_DWN 138 #define IDC_PHILO_0 1000 #define IDC_PHILO_1 1001 #define IDC_PHILO_2 1002 #define IDC_PHILO_3 1003 #define IDC_PHILO_4 1004 #define IDC_PAUSE 1006 #define IDC_PAUSED 1009 #define IDS_APP_TITLE 40000 #define IDS_PAUSED 40001 #define IDS_RUNNING 40002 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1002 #define _APS_NEXT_SYMED_VALUE 123 #endif #endif ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/README.txt ================================================ About this Example ================== This directory contains the simple DPP QP-nano example application for the EK-TM4C123GXL board (TivaC LauchPad). This directory contains portable code that should compile with any C compiler. The sub-directories contain the Board Support Packages (BSPs) for the preemptive QK-nano kernel (sub-directory qk), the cooperative QV kernel (sub-directory qv), and the Win32-QV emulation (Windows). The native kernels (QK-nano and QV-nano) further provide code and project files for the particular ARM toolchains, such as ARM (MDK-ARM), GNU, and IAR. Please refer to the README files in the sub-directories for instructions how to use and customize the example to your needs. Support Code for EK-TM4C123GXL Board ==================================== The directory qpn\3rd_party\ek-tm4c123gxl contains the CMSIS-compliant device code for the TM4C123GH6PM MCU. Please see the README.txt file in this folder for more details. Win32 Emulation =============== The sub-directory win32-qv provides the emulation of the example on Windows as a GUI application. The sub-directory contains the Makefile for the MinGW toolset and a Visual Studio solution file (dpp-gui.sln) for Visual C++. The Win32 emulation uses exactly the same code as the embedded board and differs only in the Board Support Package (bsp.c). This example demonstrates the "dual targeting" development approach, where most of the embedded code is developed on the desktop machine (Windows), but is intended for a deeply embedded target (TivaC LauchPad here). Lint Support ============ The sub-directory lint provides the scripts and configuration files for running the PC-Lint static analysis tool over the application code. Please read the README.txt file in the lint directory for more information. ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_dpp_ek-tm4c123gxl.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/lint-plus/README.txt ================================================ About this Example ================== This directory contains the facilities for "linting" the application with PC-Lint-Plus. To "lint" the application, invoke the batch "lin.bat" without parameters. The output from the "linting" is saved in the fle "lin_out.log". *** NOTE: You need to adjust the symbol PCLP_DIR at the top of the lin.bat file, to point to the directory where PC-Lint-Plus is installed on your machine. *** The PC-Lint-Plus Options File ============================= The "options.lnt" file specifies the linting options. You might need to modify this file to suit your needs. **** NOTE: The purpose of this example is NOT to find problems with the supporting 3rd-party code, which every non-trivial embedded system needs. Rather, the purpose of this particular example is to check YOUR application level code, such as state machines. **** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/lint-plus/lin.bat ================================================ @echo off :: =========================================================================== :: Product: QP-nano build script for PC-Lint-Plus, "Standard" C compiler :: Last Updated for Version: 6.7.0 :: Date of the Last Update: 2019-12-29 :: :: Q u a n t u m L e a P s :: ------------------------ :: Modern Embedded Software :: :: Copyright (C) Quantum Leaps, LLC. All rights reserved. :: :: This program is open source software: you can redistribute it and/or :: modify it under the terms of the GNU General Public License as published :: by the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: Alternatively, this program may be distributed and modified under the :: terms of Quantum Leaps commercial licenses, which expressly supersede :: the GNU General Public License and are specifically designed for :: licensees interested in retaining the proprietary status of their code. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see . :: :: Contact information: :: :: :: =========================================================================== setlocal :: Options for calling lin.bat :: NOTE: adjust to for your installation directory of PC-Lint-Plus set PCLP_DIR=C:\tools\lint-plus set PCLP=%PCLP_DIR%\pclp32.exe if NOT exist "%PCLP%" ( @echo The PC-Lint-Plus toolset not found. Please adjust lin.bat goto end ) :: set the QP/C directory set QPN=..\..\..\.. set QPN_LINT=%QPN%\ports\lint-plus set LINTFLAGS=%QPN%\ports\lint-plus\std.lnt options.lnt %1 %2 %3 %4 set PROJ_DIR=.. :: linting ------------------------------------------------------------------- %PCLP% -os(lint_out.log) %LINTFLAGS% %PROJ_DIR%\philo.c %PROJ_DIR%\table.c :end endlocal ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/lint-plus/options.lnt ================================================ ////////////////////////////////////////////////////////////////////////////// // Product: PC-Lint-Plus options for linting QP-nano applications // Last updated for version 6.7.0 // Last updated on 2019-12-30 // // Q u a n t u m L e a P s // ------------------------ // Modern Embedded Software // // Copyright (C) 2005-2019 Quantum Leaps. All rights reserved. // // This program is open source software: you can redistribute it and/or // modify it under the terms of the GNU General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Alternatively, this program may be distributed and modified under the // terms of Quantum Leaps commercial licenses, which expressly supersede // the GNU General Public License and are specifically designed for // licensees interested in retaining the proprietary status of their code. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // Contact information: // // //////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // general options -unit_check // perform only subset check (suppresses Global Wrapup) -max_threads=1 // suppress message "no '-max_threads=N' option" //-vf // print names of all source files (for debugging linting) // include directories -i.. // application includes -i%QPN%\include // QP-nano public includes -i%QPN_LINT% // QP-nano lint "port" -i%QPN_LINT%\qkn // QP-nano lint "port" to QK-nano // size options corresponding to GNU-ARM -si4 -sl4 -sll8 -ss2 -sw4 -sp4 -sf4 -sd8 -sld8 +fzl // standards %QPN_LINT%\au-misra3.lnt // MISRA-C:2012 options %QPN_LINT%\au-misra3-amd1.lnt // MISRA-C:2012 amendment 1 options %QPN_LINT%\au-ds.lnt // Dan Saks recommendations //-strong(AXJ) // Strong type checking ///////////////////////////////////////////////////////////////////////////// // QP-nano options for clients qpn.lnt // QP-nano options ///////////////////////////////////////////////////////////////////////////// // addtitional supporession rules for bulding this application ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/arm/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/arm/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 ek-tm4c123gxl 0 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 9 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 12 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 13 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP-port 1 0 0 0 4 17 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\arm\qfn_port.h qfn_port.h 0 0 4 18 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/arm/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 5060528::V5.06 update 5 (build 528)::ARMCC 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 1 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\arm\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c dpp-rel 0x4 ARM-ADS 0 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 4 0 0 1 0 0 0 0 0 2 0 1 0 0 0 0 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\arm\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\arm\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/armclang/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 ek-tm4c123gxl 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 12 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 2 13 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP-port 1 0 0 0 4 17 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 18 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/armclang/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 0 0 0 0 0 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c dpp-rel 0x4 ARM-ADS 6070000::V6.7::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 0 0 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP on EK-TM4C123GXL board, preemptive QK kernel * Last Updated for Version: 6.1.1 * Date of the Last Update: 2018-02-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIOA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1 and SW2 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_SW1) != 0U) { /* debounced SW1 state changed? */ if ((buttons.depressed & BTN_SW1) != 0U) { /* is SW1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /*..........................................................................*/ void GPIOPortA_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QACTIVE_POST_ISR((QActive *)&AO_Table, MAX_SIG, 0U); /* for testing */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... */ #if 1 /* OPTION 1: * Use the automatic FPU state preservation and the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in more than one task or * in any ISRs. This setting is the safest and recommended, but requires * extra stack space and CPU cycles. */ FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else /* OPTION 2: * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in ONE task only and not * in any ISR. This setting is very efficient, but if more than one task * (or ISR) start using the FPU, this can lead to corruption of the * FPU registers. This option should be used with CAUTION. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { GPIOF->DATA_Bits[LED_RED] = ((stat[0] == 'h') ? LED_RED : 0U); GPIOF->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { GPIOF->DATA_Bits[LED_RED] = ((paused != 0U) ? LED_RED : 0U); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ uint32_t rnd; QSchedStatus lockStat; /* <=== QK scheduler lock status */ /* The flating point code is to exercise the FPU... */ float volatile x = 3.1415926F; x = x + 2.7182818F; lockStat = QK_schedLock(N_PHILO); /* <=== lock scheduler up to N_PHILO prio */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ rnd = l_rnd * (3U*7U*11U*13U*23U); l_rnd = rnd; /* set for the next time */ QK_schedUnlock(lockStat); /* <=== unlock the scheduler */ return (rnd >> 8); } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIOA_IRQn, GPIOA_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIOA_IRQn); } /*..........................................................................*/ #ifdef QK_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ void QK_onContextSw(uint_fast8_t prev, uint_fast8_t next) { (void)prev; if (next != (uint_fast8_t)0) { //_impure_ptr = &reentrant[next]; } } #endif /* QK_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.ccsproject ================================================ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/.project ================================================ dpp-qk org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QK-nano 2 PARENT-5-PROJECT_LOC/src/qkn QP-nano 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qk/gnu TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/TM4C123GH6PM.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h gpio.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gpio.h main.c 1 PARENT-2-PROJECT_LOC/main.c philo.c 1 PARENT-2-PROJECT_LOC/philo.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c rom.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/rom.h startup_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gnu/startup_TM4C123GH6PM.c sysctl.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/sysctl.h system_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.c system_TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.h table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QK-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/README.txt ================================================ About this Example ================== This example can be built in two different ways: - from the command prompt with the provided Makefile. - from the TI Code Composer Studio with the provided CCS project. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/dpp-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/iar/dpp-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/iar/dpp-qk.ewp ================================================ 3 Debug ARM 1 General 3 31 1 1 ICCARM 2 35 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 23 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 31 1 0 ICCARM 2 35 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 23 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Debug Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qk/iar/dpp-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 6.1.1 * Date of the Last Update: 2018-02-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #define QK_SCHED_LOCK #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/arm/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/arm/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 3 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 0 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 ek-tm4c123gxl 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 9 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 12 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 13 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 3 17 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/arm/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 5060183::V5.06 update 2 (build 183)::ARMCC TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 1 0 0 1 0 0 0 0 0 2 0 1 0 0 1 1 1 1 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c dpp-rel 0x4 ARM-ADS TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 4 0 0 1 0 0 0 0 0 2 0 1 0 0 1 1 1 1 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\arm;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\arm\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/armclang/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 0 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 ek-tm4c123gxl 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 9 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 12 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 13 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 QP 1 0 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 16 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 17 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 18 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/armclang/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6070000::V6.7::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 3 3 1 1 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c dpp-rel 0x4 ARM-ADS 6070000::V6.7::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 3 3 1 1 0 0 0 NDEBUG ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c dpp.h 5 ..\..\dpp.h bsp.h 5 ..\..\bsp.h philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP on EK-TM4C123GXL board, cooperative QV kernel * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIOA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1 and SW2 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_SW1) != 0U) { /* debounced SW1 state changed? */ if ((buttons.depressed & BTN_SW1) != 0U) { /* is SW1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); } } } /*..........................................................................*/ void GPIOPortA_IRQHandler(void) { QACTIVE_POST_ISR((QActive *)&AO_Table, MAX_SIG, 0U); /* for testing */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used at the task-level only and * NOT in any ISR. This setting is very efficient, but if ISRs start using * the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0U; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { GPIOF->DATA_Bits[LED_RED] = ((stat[0] == 'h') ? LED_RED : 0U); GPIOF->DATA_Bits[LED_GREEN] = ((stat[0] == 'e') ? LED_GREEN : 0U); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { GPIOF->DATA_Bits[LED_RED] = ((paused != 0U) ? LED_RED : 0U); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* The flating point code is to exercise the FPU... */ float volatile x = 3.1415926F; x = x + 2.7182818F; /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIOA_IRQn, GPIOA_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIOA_IRQn); } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle the User LED on and then off, see NOTE02 */ GPIOF->DATA_Bits[LED_BLUE] = LED_BLUE; /* turn the Blue LED on */ GPIOF->DATA_Bits[LED_BLUE] = 0U; /* turn the Blue LED off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.ccsproject ================================================ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/.project ================================================ dpp-qv org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature qv-nano 2 PARENT-5-PROJECT_LOC/src/qvn QP-nano 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qv/gnu TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/TM4C123GH6PM.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h gpio.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gpio.h main.c 1 PARENT-2-PROJECT_LOC/main.c philo.c 1 PARENT-2-PROJECT_LOC/philo.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c rom.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/rom.h startup_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/gnu/startup_TM4C123GH6PM.c sysctl.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/sysctl.h system_TM4C123GH6PM.c 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.c system_TM4C123GH6PM.h 1 PARENT-5-PROJECT_LOC/3rd_party/ek-tm4c123gxl/system_TM4C123GH6PM.h table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QV-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := -DTARGET_IS_TM4C123_RB1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/README.txt ================================================ About this Example ================== This example can be built in two different ways: - from the command prompt with the provided Makefile. - from the TI Code Composer Studio with the provided CCS project. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/dpp-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/iar/dpp-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/iar/dpp-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/qv/iar/dpp-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/dpp_ek-tm4c123gxl/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/README.txt ================================================ About this Example ================== This directory contains the "Dining Philosophers Problem" (DPP) example for the preemptive QK kernel running on the NXP mbed-LPC1768 board (ARM Cortex-M3). This directory contains portable code that should compile with any C compiler for ARM Cortex-M. The sub-directory "gnu" contains the Makefile for a generic GNU-ARM toolset (e.g., see http://gnutoolchains.com/arm-eabi/). Thus, this project provides a way of building mbed applications locally with free and unrestricted tools. *** NOTE: To build the code on Windows, you need to download and install the GNU make utility. The Qtools collection from Quantum Leaps contains GNU make and other UNIX-style utilites for Windows (native Windows, without the need to install CygWin). *** After building the code with the provided Makefile, you can simply copy the binary image to the mbed folder for execution. The whole build process and loading the image to the mbed board can be executed directly from the QM modeling (by means of external tools). The provided QM model (dpp.qm) comes pre-configured with tools setup to build (via make) and copy the code to the mbed board. Support Code for NXP mbed-LPC1768 Board ======================================= The directory 3rd_party\mbed-lpc1768 contains the CMSIS-compliant device code for the NXP LPC176xx MCUs (ARM Cortex-M3). Please see the README.txt file in this folder for more details. Note About the Board Support Package for NXP mbed-LPC1768 ========================================================= The provided Board Support Package (see bsp.c) is minimal for the application at hand and is completely **standalone**, meaning that it does NOT use the extensive mbed driver library. The use of the mbed-library is possible, but not necessary (but requires C++). QS Software Tracing Instrumentation =================================== This example provides the "Spy" build configuration, which outputs the QS (Quantum Spy) software tracing data through UART0 of the mbed-LPC1768 board, which is connected to the virtual COM port of the mbed USB connection. The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from mbed-LPC1768 : qspy -cCOM20 The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_dpp_mbed-lpc1768.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 8 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 0 BIN\UL2CM3.DLL 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`Â —.Çv´ð4 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FCFE0 -FD10000000 -FF0LPC_IAP_512 -FL080000 -FS00 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 1 me 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 8 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 0 BIN\UL2CM3.DLL 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FCFE0 -FD10000000 -FF0LPC_IAP_512 -FL080000 -FS00 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Source Code 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\main.c main.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 mbed-lpc1768 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c system_LPC17xx.c 0 0 2 8 2 0 0 0 ..\..\..\..\.arm\startup-lpc1768\armclang\startup_LPC17xx.s startup_LPC17xx.s 0 0 QP 1 0 0 0 3 9 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 10 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 11 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 12 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 13 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/armclang/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 LPC1768 NXP Keil.LPC1700_DFP.2.2.0 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD10000000 -FCFE0 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM)) 0 $$Device:LPC1768$Device\Include\LPC17xx.h $$Device:LPC1768$SVD\LPC176x5x.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 1 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 1 0x0 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 0 0x2007c000 0x8000 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 rvmdk __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\mbed-lpc1768 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c mbed-lpc1768 system_LPC17xx.c 1 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c startup_LPC17xx.s 2 ..\..\..\..\..\3rd_party\mbed-lpc1768\arm\startup_LPC17xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 LPC1768 NXP Keil.LPC1700_DFP.2.2.0 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD10000000 -FCFE0 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM)) 0 $$Device:LPC1768$Device\Include\LPC17xx.h $$Device:LPC1768$SVD\LPC176x5x.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 1 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 1 0x0 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 0 0x2007c000 0x8000 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\mbed-lpc1768 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c mbed-lpc1768 system_LPC17xx.c 1 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c startup_LPC17xx.s 2 ..\..\..\..\..\3rd_party\mbed-lpc1768\arm\startup_LPC17xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP on EK-TM4C123GXL board, preemptive QK kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "LPC17xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { EINT0_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void EINT0_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ /* LEDs available on the board */ #define LED_1 (1U << 18) /* P1.18 */ #define LED_2 (1U << 20) /* P1.20 */ #define LED_3 (1U << 21) /* P1.21 */ #define LED_4 (1U << 23) /* P1.23 */ /* Push-Button wired externally to DIP8 (P0.6) */ #define BTN_EXT (1U << 6) /* P0.6 */ /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~LPC_GPIO0->FIOPIN; /* read P0 with the state of the Buttons */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /*..........................................................................*/ void EINT0_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QACTIVE_POST_ISR(&AO_Table, MAX_SIG, 0U); /* for testing */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* turn the GPIO clock on */ LPC_SC->PCONP |= (1U << 15); /* setup the GPIO pin functions for the LEDs... */ LPC_PINCON->PINSEL3 &= ~(3U << 4); /* LED_1: function P1.18 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 8); /* LED_2: function P1.20 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 10); /* LED_3: function P1.21 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 14); /* LED_4: function P1.23 to GPIO */ /* Set GPIO-P1 LED pins to output */ LPC_GPIO1->FIODIR |= (LED_1 | LED_2 | LED_3 | LED_4); /* setup the GPIO pin function for the Button... */ LPC_PINCON->PINSEL0 &= ~(3U << 12); /* function P0.6 to GPIO, pull-up */ /* Set GPIO-P0 Button pin as input */ LPC_GPIO0->FIODIR &= ~BTN_EXT; BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { LPC_GPIO1->FIOSET = LED_1; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_1; /* turn LED off */ } if (stat[0] == 'e') { LPC_GPIO1->FIOSET = LED_2; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_2; /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != (uint8_t)0) { LPC_GPIO1->FIOSET = LED_3; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_3; /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(EINT0_IRQn, EINT0_PRIO); /* ... */ /* enable IRQs in the NVIC... */ NVIC_EnableIRQ(EINT0_IRQn); } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED on and then off, see NOTE01 */ QF_INT_DISABLE(); LPC_GPIO1->FIOSET = LED_4; /* turn LED on */ __NOP(); /* a couple of NOPs to actually see the LED glow */ __NOP(); __NOP(); __NOP(); LPC_GPIO1->FIOCLR = LED_4; /* turn LED off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on mbed-LPC1768, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/mbed-lpc1768 \ $(QPN)/3rd_party/mbed-lpc1768/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/mbed-lpc1768 #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_LPC17xx.c \ startup_LPC17xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m3 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/gnu/dpp-qk.ld ================================================ /***************************************************************************** * Product: Linker script for for LPC1768, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of mbed-LPC1768 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 512K RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x7FDF USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewd ================================================ 2 Debug ARM 1 C-SPY 2 26 1 1 ARMSIM_ID 2 1 1 1 ANGEL_ID 2 0 1 1 CMSISDAP_ID 2 2 1 1 GDBSERVER_ID 2 0 1 1 IARROM_ID 2 1 1 1 IJET_ID 2 6 1 1 JLINK_ID 2 15 1 1 LMIFTDI_ID 2 2 1 1 MACRAIGOR_ID 2 3 1 1 PEMICRO_ID 2 1 1 1 RDI_ID 2 2 1 1 STLINK_ID 2 2 1 1 THIRDPARTY_ID 2 0 1 1 XDS100_ID 2 2 1 1 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 26 1 0 ARMSIM_ID 2 1 1 0 ANGEL_ID 2 0 1 0 CMSISDAP_ID 2 2 1 0 GDBSERVER_ID 2 0 1 0 IARROM_ID 2 1 1 0 IJET_ID 2 6 1 0 JLINK_ID 2 15 1 0 LMIFTDI_ID 2 2 1 0 MACRAIGOR_ID 2 3 1 0 PEMICRO_ID 2 1 1 0 RDI_ID 2 2 1 0 STLINK_ID 2 2 1 0 THIRDPARTY_ID 2 0 1 0 XDS100_ID 2 2 1 0 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.ewp ================================================ 2 Debug ARM 1 General 3 22 1 1 ICCARM 2 31 1 1 AARM 2 9 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 16 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 22 1 0 ICCARM 2 31 1 0 AARM 2 9 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 16 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c mbed-lpc1768 $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\LPC17xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\iar\startup_LPC17xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP-port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qk/iar/dpp-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0007FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x10000000; define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define symbol __CRP_start__ = 0x000002FC; define symbol __CRP_end__ = 0x000002FF; define symbol __RAM1_start__ = 0x2007C000; define symbol __RAM1_end__ = 0x20083FFF; define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__] - mem:[from __CRP_start__ to __CRP_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define region CRP_region = mem:[from __CRP_start__ to __CRP_end__]; define region RAM1_region = mem:[from __RAM1_start__ to __RAM1_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; place in CRP_region { section .crp }; place in RAM1_region { section .sram }; ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/armclang/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 8 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 0 BIN\UL2CM3.DLL 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`Â —.Çv´ð4 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FCFE0 -FD10000000 -FF0LPC_IAP_512 -FL080000 -FS00 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 1 me 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 8 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 0 BIN\UL2CM3.DLL 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FCFE0 -FD10000000 -FF0LPC_IAP_512 -FL080000 -FS00 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Source Code 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\main.c main.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 mbed-lpc1768 1 0 0 0 2 7 1 0 0 0 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c system_LPC17xx.c 0 0 2 8 2 0 0 0 ..\..\..\..\.arm\startup-lpc1768\armclang\startup_LPC17xx.s startup_LPC17xx.s 0 0 QP 1 0 0 0 3 9 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 10 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 11 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP-port 1 0 0 0 4 12 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 13 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/armclang/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 LPC1768 NXP Keil.LPC1700_DFP.2.2.0 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD10000000 -FCFE0 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM)) 0 $$Device:LPC1768$Device\Include\LPC17xx.h $$Device:LPC1768$SVD\LPC176x5x.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 1 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 1 0x0 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 0 0x2007c000 0x8000 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 rvmdk __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\mbed-lpc1768 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c mbed-lpc1768 system_LPC17xx.c 1 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c startup_LPC17xx.s 2 ..\..\..\..\..\3rd_party\mbed-lpc1768\arm\startup_LPC17xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 LPC1768 NXP Keil.LPC1700_DFP.2.2.0 http://www.keil.com/pack/ IROM(0x00000000,0x80000) IRAM(0x10000000,0x8000) IRAM2(0x2007C000,0x8000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD10000000 -FCFE0 -FN1 -FF0LPC_IAP_512 -FS00 -FL080000 -FP0($$Device:LPC1768$Flash\LPC_IAP_512.FLM)) 0 $$Device:LPC1768$Device\Include\LPC17xx.h $$Device:LPC1768$SVD\LPC176x5x.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 1 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 1 0x0 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x10000000 0x8000 0 0x2007c000 0x8000 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\mbed-lpc1768 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c mbed-lpc1768 system_LPC17xx.c 1 ..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c startup_LPC17xx.s 2 ..\..\..\..\..\3rd_party\mbed-lpc1768\arm\startup_LPC17xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP-port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP on EK-TM4C123GXL board, coopearative QV kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "LPC17xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { EINT0_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void EINT0_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ /* LEDs available on the board */ #define LED_1 (1U << 18) /* P1.18 */ #define LED_2 (1U << 20) /* P1.20 */ #define LED_3 (1U << 21) /* P1.21 */ #define LED_4 (1U << 23) /* P1.23 */ /* Push-Button wired externally to DIP8 (P0.6) */ #define BTN_EXT (1U << 6) /* P0.6 */ /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~LPC_GPIO0->FIOPIN; /* read P0 with the state of the Buttons */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /*..........................................................................*/ void EINT0_IRQHandler(void) { QACTIVE_POST_ISR(&AO_Table, MAX_SIG, 0U); /* for testing */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* turn the GPIO clock on */ LPC_SC->PCONP |= (1U << 15); /* setup the GPIO pin functions for the LEDs... */ LPC_PINCON->PINSEL3 &= ~(3U << 4); /* LED_1: function P1.18 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 8); /* LED_2: function P1.20 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 10); /* LED_3: function P1.21 to GPIO */ LPC_PINCON->PINSEL3 &= ~(3U << 14); /* LED_4: function P1.23 to GPIO */ /* Set GPIO-P1 LED pins to output */ LPC_GPIO1->FIODIR |= (LED_1 | LED_2 | LED_3 | LED_4); /* setup the GPIO pin function for the Button... */ LPC_PINCON->PINSEL0 &= ~(3U << 12); /* function P0.6 to GPIO, pull-up */ /* Set GPIO-P0 Button pin as input */ LPC_GPIO0->FIODIR &= ~BTN_EXT; BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { LPC_GPIO1->FIOSET = LED_1; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_1; /* turn LED off */ } if (stat[0] == 'e') { LPC_GPIO1->FIOSET = LED_2; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_2; /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != (uint8_t)0) { LPC_GPIO1->FIOSET = LED_3; /* turn LED on */ } else { LPC_GPIO1->FIOCLR = LED_3; /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(EINT0_IRQn, EINT0_PRIO); /* ... */ /* enable IRQs in the NVIC... */ NVIC_EnableIRQ(EINT0_IRQn); } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle the User LED on and then off, see NOTE01 */ LPC_GPIO1->FIOSET = LED_4; /* turn LED on */ __NOP(); /* a couple of NOPs to actually see the LED glow */ __NOP(); __NOP(); __NOP(); LPC_GPIO1->FIOCLR = LED_4; /* turn LED off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QK_ISR_ENTRY/QK_ISR_ENTRY * macros or any other QF/QK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF/QK services. In particular they * can NOT call the macros QK_ISR_ENTRY/QK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * The User LED is used to visualize the idle loop activity. The brightness * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on mbed-LPC1768, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/mbed-lpc1768 \ $(QPN)/3rd_party/mbed-lpc1768/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/mbed-lpc1768 #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_LPC17xx.c \ startup_LPC17xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m3 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/gnu/dpp-qv.ld ================================================ /***************************************************************************** * Product: Linker script for for LPC1768, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) 2002-2013 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of mbed-LPC1768 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 512K RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x7FDF USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/iar/dpp-qv.ewd ================================================ 2 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 ANGEL_ID 2 0 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IARROM_ID 2 1 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 MACRAIGOR_ID 2 3 1 1 PEMICRO_ID 2 3 1 1 RDI_ID 2 2 1 1 STLINK_ID 2 3 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 5 1 1 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 ANGEL_ID 2 0 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IARROM_ID 2 1 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 MACRAIGOR_ID 2 3 1 0 PEMICRO_ID 2 3 1 0 RDI_ID 2 2 1 0 STLINK_ID 2 3 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 5 1 0 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/iar/dpp-qv.ewp ================================================ 2 Debug ARM 1 General 3 24 1 1 ICCARM 2 31 1 1 AARM 2 9 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 17 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 24 1 0 ICCARM 2 31 1 0 AARM 2 9 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 17 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c mbed-lpc1768 $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\LPC17xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\iar\startup_LPC17xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\mbed-lpc1768\system_LPC17xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/qv/iar/dpp-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0007FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x10000000; define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define symbol __CRP_start__ = 0x000002FC; define symbol __CRP_end__ = 0x000002FF; define symbol __RAM1_start__ = 0x2007C000; define symbol __RAM1_end__ = 0x20083FFF; define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__] - mem:[from __CRP_start__ to __CRP_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define region CRP_region = mem:[from __CRP_start__ to __CRP_end__]; define region RAM1_region = mem:[from __RAM1_start__ to __RAM1_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; place in CRP_region { section .crp }; place in RAM1_region { section .sram }; ================================================ FILE: examples/arm-cm/dpp_mbed-lpc1768/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/README.txt ================================================ About this Example ================== This folder contains the simple "Blinky" QP example application. This directory contains portable code that should compile with any C compiler for ARM Cortex-M. The sub-directories contain code and project files, which are specific to the particular ARM toolchains, such as ARM-KEIL (MDK-ARM), GNU, and IAR. Please refer to the README files in the sub-directories for specific instructions how to use and customize the example to your needs. Support Code for STM32 NUCLEO-L053R8 Board ------------------------------------------ The directory qpc\3rd_party\nucleo-l053r8 contains the CMSIS- compliant device code for the STM32L0xx MCUs (ARM Cortex-M0+). Please see the README file in this folder for more details. QS Software Tracing Instrumentation =================================== This example provides the "Spy" build configuration, which outputs the QS (Quantum Spy) software tracing data through UART2, which is connected to the virtual COM port of the ST-Link V2 USB debugger. The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from NUCLEO board: qspy -cCOM20 The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_dpp_nucleo-l053r8.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::STM32L0xx_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numberical value of the heap size. Startup Code ============ The startup code for the STM32L1xx MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s The file startup_stm32l053xx.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** Adjusting the CPU Clock Speed ============================= The current setting is to run at 2MHz from the MSI (internal oscillator), but the CPU clock speed can be modified by editing the file system_stm32l1xx.c. Ther file system_stm32l0xx.c.pll provides an example of clock setting using the PLL driven from the MSE. *** NOTE: The NUCLEO boards have a wide range of possible clock selections, depending on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information. *** ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM)) 0 ST-LINKIII-KEIL_SWO -U066CFF484951775087074312 -O8431 -SF480 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 10000000 dpp-rel 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM)) 0 ST-LINKIII-KEIL_SWO -U066CFF484951775087074312 -O8431 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 10000000 Source Code 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\main.c main.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 nucleo-l053r8 1 0 0 0 2 7 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l0xx.h 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h stm32l053xx.h 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.c 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h system_stm32l0xx.h 0 0 2 11 2 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s startup_stm32l053xx.s 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 15 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 16 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/armclang/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L053R8Tx STMicroelectronics Keil.STM32L0xx_DFP.2.0.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$Flash\STM32L0xx_64.FLM)) 0 $$Device:STM32L053R8Tx$Device\Include\stm32l0xx.h $$Device:STM32L053R8Tx$SVD\STM32L053x.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP DARMCM1.DLL -pCM0+ SARMCM3.DLL TARMCM1.DLL -pCM0+ 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M0+" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 1 0x8000000 0x10000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x10000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c nucleo-l053r8 stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l053xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h system_stm32l0xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h startup_stm32l053xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L053R8Tx STMicroelectronics Keil.STM32L0xx_DFP.2.0.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$Flash\STM32L0xx_64.FLM)) 0 $$Device:STM32L053R8Tx$Device\Include\stm32l0xx.h $$Device:STM32L053R8Tx$SVD\STM32L053x.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP DARMCM1.DLL -pCM0+ SARMCM3.DLL TARMCM1.DLL -pCM0+ 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M0+" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 1 0x8000000 0x10000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x10000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c nucleo-l053r8 stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l053xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h system_stm32l0xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h startup_stm32l053xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP on STM32 NUCLEO-L053R8 board, preemptive QK kernel * Last Updated for Version: 6.1.1 * Date of the Last Update: 2018-02-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "stm32l0xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelAwareISRs { GPIOPORTA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ /* LED pins available on the board (just one user LED LD2--Green on PA.5) */ #define LED_LD2 (1U << 5) /* Button pins available on the board (just one user Button B1 on PC.13) */ #define BTN_B1 (1U << 13) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOC->IDR; /* read Port C with the state of Button B1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_B1) != 0U) { /* debounced B1 state changed? */ if ((buttons.depressed & BTN_B1) != 0U) { /* is B1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* enable GPIOA clock port for the LED LD2 */ RCC->IOPENR |= (1U << 0); /* configure LED (PA.5) pin as push-pull output, no pull-up, pull-down */ GPIOA->MODER &= ~((3U << 2*5)); GPIOA->MODER |= ((1U << 2*5)); GPIOA->OTYPER &= ~((1U << 5)); GPIOA->OSPEEDR &= ~((3U << 2*5)); GPIOA->OSPEEDR |= ((1U << 2*5)); GPIOA->PUPDR &= ~((3U << 2*5)); /* enable GPIOC clock port for the Button B1 */ RCC->IOPENR |= (1U << 2); /* configure Button (PC.13) pins as input, no pull-up, pull-down */ GPIOC->MODER &= ~(3U << 2*13); GPIOC->OSPEEDR &= ~(3U << 2*13); GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { GPIOA->BSRR |= LED_LD2; /* turn LED on */ } else { GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enough LEDs to implement this feature */ if (paused != (uint8_t)0) { //GPIOA->BSRR |= (LED_LD2); /* turn LED[n] on */ } else { //GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED[n] off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ #ifdef QK_ON_CONTEXT_SW /* NOTE: the context-switch callback is called with interrupts DISABLED */ void QK_onContextSw(uint_fast8_t prev, uint_fast8_t next) { (void)prev; if (next != (uint_fast8_t)0) { //_impure_ptr = &reentrant[next]; } } #endif /* QK_ON_CONTEXT_SW */ /*..........................................................................*/ void QK_onIdle(void) { /* toggle an LED on and then off (not enough LEDs, see NOTE01) */ QF_INT_DISABLE(); //GPIOA->BSRR |= (LED_LD2); /* turn LED[n] on */ //GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED[n] off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with CAUTION. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader * instead of your broken code. When done disconnect BOOT0, and start over. */ //__WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG GPIOA->BSRR |= LED_LD2; /* turn LED on */ for (;;) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/.project ================================================ dpp-qk_nucleo-l053r8 org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QK-nano 2 $%7BPARENT-5-PROJECT_LOC%7D/src/qkn QP-nano 2 $%7BPARENT-5-PROJECT_LOC%7D/src/qfn QP_port 2 $%7BPARENT-5-PROJECT_LOC%7D/ports/arm-cm/qk/gnu bsp.c 1 $%7BPARENT-1-PROJECT_LOC%7D/bsp.c bsp.h 1 $%7BPARENT-2-PROJECT_LOC%7D/bsp.h dpp.h 1 $%7BPARENT-2-PROJECT_LOC%7D/dpp.h main.c 1 $%7BPARENT-2-PROJECT_LOC%7D/main.c nucleo-l053r8 2 $%7BPARENT-5-PROJECT_LOC%7D/3rd_party/nucleo-l053r8 philo.c 1 $%7BPARENT-2-PROJECT_LOC%7D/philo.c qstamp.c 1 $%7BPARENT-5-PROJECT_LOC%7D/include/qstamp.c table.c 1 $%7BPARENT-2-PROJECT_LOC%7D/table.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on NUCLEO-L053R8, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/nucleo-l053r8 \ $(QPN)/3rd_party/nucleo-l053r8/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/nucleo-l053r8 #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_stm32l0xx.c \ startup_stm32l053xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m0plus ARM_ARCH := 6 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O2 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O2 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O2 $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O2 $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/dpp-qk.ld ================================================ /***************************************************************************** * Product: Linker script for for STM32L053R8, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of STM32L053R8 */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/dpp-qk_nucleo-l053r8.elf.launch ================================================ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/gnu/stm32_flash.ld ================================================ /* ****************************************************************************** File: stm32_flash.ld Info: Generated by Atollic TrueSTUDIO(R) 9.0.0 2018-02-14 Abstract: Linker script for STM32L053R8 device Set heap size, stack size, stack location, memory areas and sections according to application requirements. The MIT License (MIT) Copyright (c) 2018 STMicroelectronics Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************** */ /* Entry Point */ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = 0x20002000; /* end of 8K RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0; /* required amount of heap */ _Min_Stack_Size = 0x80; /* required amount of stack */ /* Specify the memory areas */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K } /* Define output sections */ SECTIONS { /* The startup code goes first into FLASH */ .isr_vector : { . = ALIGN(4); KEEP(*(.isr_vector)) /* Startup code */ . = ALIGN(4); } >FLASH /* The program code and other data goes into FLASH */ .text : { . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ *(.eh_frame) KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); _etext = .; /* define a global symbols at end of code */ } >FLASH /* Constant data goes into FLASH */ .rodata : { . = ALIGN(4); *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ . = ALIGN(4); } >FLASH .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH .ARM : { __exidx_start = .; *(.ARM.exidx*) __exidx_end = .; } >FLASH .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >FLASH .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >FLASH .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array*)) PROVIDE_HIDDEN (__fini_array_end = .); } >FLASH /* used by the startup to initialize data */ _sidata = LOADADDR(.data); /* Initialized data sections goes into RAM, load LMA copy after code */ .data : { . = ALIGN(4); _sdata = .; /* create a global symbol at data start */ *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); _edata = .; /* define a global symbol at data end */ } >RAM AT> FLASH /* Uninitialized data section */ . = ALIGN(4); .bss : { /* This is used by the startup in order to initialize the .bss secion */ _sbss = .; /* define a global symbol at bss start */ __bss_start__ = _sbss; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = _ebss; } >RAM /* User_heap_stack section, used to check that there is enough RAM left */ ._user_heap_stack : { . = ALIGN(4); PROVIDE ( end = . ); PROVIDE ( _end = . ); . = . + _Min_Heap_Size; . = . + _Min_Stack_Size; . = ALIGN(4); } >RAM /* MEMORY_bank1 section, code must be located here explicitly */ /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */ .memory_b1_text : { *(.mb1text) /* .mb1text sections (code) */ *(.mb1text*) /* .mb1text* sections (code) */ *(.mb1rodata) /* read-only data (constants) */ *(.mb1rodata*) } >MEMORY_B1 /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } .ARM.attributes 0 : { *(.ARM.attributes) } } ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/iar/dpp-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/iar/dpp-qk.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c nucleo-l053r8 $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\iar\startup_stm32l053xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qk/iar/dpp-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x08000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; define symbol __region_EEPROM_start__ = 0x08080000; define symbol __region_EEPROM_end__ = 0x080807FF; define region EEPROM_region = mem:[from __region_EEPROM_start__ to __region_EEPROM_end__]; place in EEPROM_region { section .eeprom }; ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 6.1.1 * Date of the Last Update: 2018-02-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #define QK_ON_CONTEXT_SW #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::STM32L0xx_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numberical value of the heap size. Startup Code ============ The startup code for the STM32L1xx MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s The file startup_stm32l053xx.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** Adjusting the CPU Clock Speed ============================= The current setting is to run at 2MHz from the MSI (internal oscillator), but the CPU clock speed can be modified by editing the file system_stm32l1xx.c. Ther file system_stm32l0xx.c.pll provides an example of clock setting using the PLL driven from the MSE. *** NOTE: The NUCLEO boards have a wide range of possible clock selections, depending on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information. *** ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM)) 0 ST-LINKIII-KEIL_SWO -U066CFF484951775087074312 -O8431 -SF480 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 10000000 dpp-rel 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM)) 0 ST-LINKIII-KEIL_SWO -U066CFF484951775087074312 -O8431 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P2 -N00("ARM CoreSight SW-DP") -D00(0BC11477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64.FLM -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$CMSIS\Flash\STM32L0xx_64.FLM) 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 2 10000000 Source Code 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\main.c main.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 nucleo-l053r8 1 0 0 0 2 7 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l0xx.h 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h stm32l053xx.h 0 0 2 9 1 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.c 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h system_stm32l0xx.h 0 0 2 11 2 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s startup_stm32l053xx.s 0 0 QP 1 0 0 0 3 12 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 15 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 16 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/armclang/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L053R8Tx STMicroelectronics Keil.STM32L0xx_DFP.2.0.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$Flash\STM32L0xx_64.FLM)) 0 $$Device:STM32L053R8Tx$Device\Include\stm32l0xx.h $$Device:STM32L053R8Tx$SVD\STM32L053x.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP DARMCM1.DLL -pCM0+ SARMCM3.DLL TARMCM1.DLL -pCM0+ 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M0+" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 1 0x8000000 0x10000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x10000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c nucleo-l053r8 stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l053xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h system_stm32l0xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h startup_stm32l053xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L053R8Tx STMicroelectronics Keil.STM32L0xx_DFP.2.0.0 http://www.keil.com/pack/ IRAM(0x20000000,0x00002000) IROM(0x08000000,0x00010000) CPUTYPE("Cortex-M0+") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L0xx_64 -FS08000000 -FL010000 -FP0($$Device:STM32L053R8Tx$Flash\STM32L0xx_64.FLM)) 0 $$Device:STM32L053R8Tx$Device\Include\stm32l0xx.h $$Device:STM32L053R8Tx$SVD\STM32L053x.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP DARMCM1.DLL -pCM0+ SARMCM3.DLL TARMCM1.DLL -pCM0+ 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M0+" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 1 0x8000000 0x10000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x10000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x2000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\nucleo-l053r8 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Source Code bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c table.c 1 ..\..\table.c nucleo-l053r8 stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h stm32l053xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h system_stm32l0xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c system_stm32l0xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h startup_stm32l053xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l053r8\arm\startup_stm32l053xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP on STM32 NUCLEO-L053R8 board, cooperative QV kernel ** Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "stm32l0xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelAwareISRs { GPIOPORTA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ /* LED pins available on the board (just one user LED LD2--Green on PA.5) */ #define LED_LD2 (1U << 5) /* Button pins available on the board (just one user Button B1 on PC.13) */ #define BTN_B1 (1U << 13) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOC->IDR; /* read Port C with the state of Button B1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_B1) != 0U) { /* debounced B1 state changed? */ if ((buttons.depressed & BTN_B1) != 0U) { /* is B1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* enable GPIOA clock port for the LED LD2 */ RCC->IOPENR |= (1U << 0); /* configure LED (PA.5) pin as push-pull output, no pull-up, pull-down */ GPIOA->MODER &= ~((3U << 2*5)); GPIOA->MODER |= ((1U << 2*5)); GPIOA->OTYPER &= ~((1U << 5)); GPIOA->OSPEEDR &= ~((3U << 2*5)); GPIOA->OSPEEDR |= ((1U << 2*5)); GPIOA->PUPDR &= ~((3U << 2*5)); /* enable GPIOC clock port for the Button B1 */ RCC->IOPENR |= (1U << 2); /* configure Button (PC.13) pins as input, no pull-up, pull-down */ GPIOC->MODER &= ~(3U << 2*13); GPIOC->OSPEEDR &= ~(3U << 2*13); GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { GPIOA->BSRR |= LED_LD2; /* turn LED on */ } else { GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enough LEDs to implement this feature */ if (paused != (uint8_t)0) { //GPIOA->BSRR |= (LED_LD2); /* turn LED[n] on */ } else { //GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED[n] off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE1 */ /* toggle an LED on and then off (not enough LEDs, see NOTE2) */ //GPIOA->BSRR |= (LED_LD2); /* turn LED[n] on */ //GPIOA->BSRR |= (LED_LD2 << 16); /* turn LED[n] off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with CAUTION. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader * instead of your broken code. When done disconnect BOOT0, and start over. */ //QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ QF_INT_ENABLE(); /* for now, just enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE1: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE2: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/.project ================================================ dpp-qv_nucleo-l053r8 org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QP-nano 2 $%7BPARENT-5-PROJECT_LOC%7D/src/qfn QP_port 2 $%7BPARENT-5-PROJECT_LOC%7D/ports/arm-cm/qv/gnu QV-nano 2 $%7BPARENT-5-PROJECT_LOC%7D/src/qvn bsp.c 1 $%7BPARENT-1-PROJECT_LOC%7D/bsp.c bsp.h 1 $%7BPARENT-2-PROJECT_LOC%7D/bsp.h dpp.h 1 $%7BPARENT-2-PROJECT_LOC%7D/dpp.h main.c 1 $%7BPARENT-2-PROJECT_LOC%7D/main.c nucleo-l053r8 2 $%7BPARENT-5-PROJECT_LOC%7D/3rd_party/nucleo-l053r8 philo.c 1 $%7BPARENT-2-PROJECT_LOC%7D/philo.c qstamp.c 1 $%7BPARENT-5-PROJECT_LOC%7D/include/qstamp.c table.c 1 $%7BPARENT-2-PROJECT_LOC%7D/table.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on NUCLEO-L053R8, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/nucleo-l053r8 \ $(QPN)/3rd_party/nucleo-l053r8/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/nucleo-l053r8 #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_stm32l0xx.c \ startup_stm32l053xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m0plus ARM_ARCH := 6 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O2 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O2 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O2 $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O2 $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/gnu/dpp-qv.ld ================================================ /***************************************************************************** * Product: Linker script for for STM32L053R8, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of STM32L053R8 */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c nucleo-l053r8 $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\iar\startup_stm32l053xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l053xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\stm32l0xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l053r8\system_stm32l0xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/qv/iar/dpp-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x08000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0800FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20001FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; define symbol __region_EEPROM_start__ = 0x08080000; define symbol __region_EEPROM_end__ = 0x080807FF; define region EEPROM_region = mem:[from __region_EEPROM_start__ to __region_EEPROM_end__]; place in EEPROM_region { section .eeprom }; ================================================ FILE: examples/arm-cm/dpp_nucleo-l053r8/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/README.txt ================================================ About this Example ================== This directory contains the "Dining Philosophers Problem" (DPP) example for CMSIS-RTOS RTX application running on the STM32 NUCLEO-L152RE board (ARM Cortex-M3). This directory contains portable code that should compile with any C compiler for ARM Cortex-M. The sub-directories contain code and project files, which are specific to the particular ARM toolchains, such as ARM (MDK-ARM) and IAR. Please refer to the README files in the sub-directories for specific instructions how to use and customize the example to your needs. Support Code for NUCLEO-L152RE Board ==================================== The directory qpc\3rd_party\nucleo-l152re contains the CMSIS-compliant device code for the STM32L152xx MCUs (ARM Cortex-M3). Please see the README.txt file in this folder for more details. Adjusting the CPU Clock Speed ============================= The current setting is to run at 2MHz from the MSI (internal oscillator), but the CPU clock speed can be modified by editing the file system_stm32l1xx.c. Ther file system_stm32l1xx_pll.c provides an example of clock setting using the PLL driven from the MSE. *** NOTE: The NUCLEO boards have a wide range of possible clock selections, depending on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information. *** QS Software Tracing Instrumentation =================================== This example provides the "Spy" build configuration, which outputs the QS (Quantum Spy) software tracing data through UART2, which is connected to the virtual COM port of the ST-Link debugger. The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from NUCLEO-L152RE: qspy -cCOM20 The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_dpp_nucleo-l152re.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::STM32L152_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numberical value of the heap size. Startup Code ============ The startup code for the STM32L1xx MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s The file startup_stm32l1xx.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** Adjusting the CPU Clock Speed ============================= The current setting is to run at 2MHz from the MSI (internal oscillator), but the CPU clock speed can be modified by editing the file system_stm32l1xx.c. Ther file system_stm32l1xx_pll.c provides an example of clock setting using the PLL driven from the MSE. *** NOTE: The NUCLEO boards have a wide range of possible clock selections, depending on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information. *** ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/armclang/dpp-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ST-LINKIII-KEIL_SWO -U066EFF495056805087184715 -I0 -O8398 -S1 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM) 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 0 214 1
0
0 0 0 0 0 0 ..\bsp.c
1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
dpp-rel 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ST-LINKIII-KEIL_SWO -U066EFF495056805087184715 -I0 -O8430 -S1 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM) 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 0 214 1
0
0 0 0 0 0 0 ..\bsp.c
1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Application 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 3 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 4 1 0 0 0 ..\..\main.c main.c 0 0 1 5 1 0 0 0 ..\..\philo.c philo.c 0 0 1 6 5 0 0 0 ..\..\README.txt README.txt 0 0 1 7 1 0 0 0 ..\..\table.c table.c 0 0 nucleo-l152re 1 0 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt README.txt 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h stm32l1xx.h 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.c 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h system_stm32l1xx.h 0 0 2 12 2 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s startup_stm32l1xx.s 0 0 QP 1 0 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 16 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 17 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/armclang/dpp-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L152RE STMicroelectronics Keil.STM32L1xx_DFP.1.0.2 http://www.keil.com/pack/ IROM(0x08000000,0x80000) IRAM(0x20000000,0x14000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 $$Device:STM32L152RE$Device\Include\STM32L1xx.h $$Device:STM32L152RE$SVD\STM32L1xx.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qk.bin .\dbg\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 1 0x8000000 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 HSE_VALUE=4000000 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include; ..\..\..\..\..\3rd_party\nucleo-l152re 1 0 0 0 0 0 0 1 0 0 Stack_Size=512 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Application bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c README.txt 5 ..\..\README.txt table.c 1 ..\..\table.c nucleo-l152re README.txt 5 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h system_stm32l1xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h startup_stm32l1xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L152RE STMicroelectronics Keil.STM32L1xx_DFP.1.0.2 http://www.keil.com/pack/ IROM(0x08000000,0x80000) IRAM(0x20000000,0x14000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 $$Device:STM32L152RE$Device\Include\STM32L1xx.h $$Device:STM32L152RE$SVD\STM32L1xx.svd 0 0 0 0 0 0 1 .\rel\ dpp-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qk.bin .\rel\dpp-qk.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 1 0x8000000 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include; ..\..\..\..\..\3rd_party\nucleo-l152re 1 0 0 0 0 0 0 1 0 0 Stack_Size=512 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qk.sct --entry Reset_Handler Application bsp.c 1 ..\bsp.c bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c README.txt 5 ..\..\README.txt table.c 1 ..\..\table.c nucleo-l152re README.txt 5 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h system_stm32l1xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h startup_stm32l1xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP on STM32 NUCLEO-L152RE board, preemptive QK kernel * Last Updated for Version: 6.1.0 * Date of the Last Update: 2018-02-14 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "stm32l1xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIOPORTA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ /* LED pins available on the board (just one user LED LD2--Green on PA.5) */ #define LED_LD2 (1U << 5) /* Button pins available on the board (just one user Button B1 on PC.13) */ #define BTN_B1 (1U << 13) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOC->IDR; /* read Port C with the state of Button B1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_B1) != 0U) { /* debounced B1 state changed? */ if ((buttons.depressed & BTN_B1) != 0U) { /* is B1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* enable GPIOA clock port for the LED LD2 */ RCC->AHBENR |= (1U << 0); /* configure LED (PA.5) pin as push-pull output, no pull-up, pull-down */ GPIOA->MODER &= ~((3U << 2*5)); GPIOA->MODER |= ((1U << 2*5)); GPIOA->OTYPER &= ~((1U << 5)); GPIOA->OSPEEDR &= ~((3U << 2*5)); GPIOA->OSPEEDR |= ((1U << 2*5)); GPIOA->PUPDR &= ~((3U << 2*5)); /* enable GPIOC clock port for the Button B1 */ RCC->AHBENR |= (1U << 2); /* configure Button (PC.13) pins as input, no pull-up, pull-down */ GPIOC->MODER &= ~(3U << 2*13); GPIOC->OSPEEDR &= ~(3U << 2*13); GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { GPIOA->BSRRL |= LED_LD2; /* turn LED on */ } else { GPIOA->BSRRH |= LED_LD2; /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enough LEDs to implement this feature */ if (paused != (uint8_t)0) { //GPIOA->BSRRL |= LED_LD2; /* turn LED on */ } else { //GPIOA->BSRRH |= LED_LD2; /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle an LED on and then off (not enough LEDs, see NOTE01) */ QF_INT_DISABLE(); //GPIOA->BSRRL |= LED_LD2; /* turn LED on */ //GPIOA->BSRRH |= LED_LD2; /* turn LED off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with CAUTION. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader * instead of your broken code. When done disconnect BOOT0, and start over. */ //__WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/gnu/.project ================================================ dpp-qk_nucleo-l152re org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QK 2 PARENT-5-PROJECT_LOC/src/qkn QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qk/gnu bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h main.c 1 PARENT-2-PROJECT_LOC/main.c nucleo-l152re 2 PARENT-5-PROJECT_LOC/3rd_party/nucleo-l152re philo.c 1 PARENT-2-PROJECT_LOC/philo.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on NUCLEO-L152RE, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/nucleo-l152re \ $(QPN)/3rd_party/nucleo-l152re/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/nucleo-l152re #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_stm32l1xx.c \ startup_stm32l1xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m3 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/gnu/dpp-qk.ld ================================================ /***************************************************************************** * Product: Linker script for for STM32L152RET6, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of STM32L152RET6 */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/iar/dpp-qk.ewd ================================================ 2 Debug ARM 1 C-SPY 2 26 1 1 ARMSIM_ID 2 1 1 1 ANGEL_ID 2 0 1 1 CMSISDAP_ID 2 2 1 1 GDBSERVER_ID 2 0 1 1 IARROM_ID 2 1 1 1 IJET_ID 2 6 1 1 JLINK_ID 2 15 1 1 LMIFTDI_ID 2 2 1 1 MACRAIGOR_ID 2 3 1 1 PEMICRO_ID 2 1 1 1 RDI_ID 2 2 1 1 STLINK_ID 2 2 1 1 THIRDPARTY_ID 2 0 1 1 XDS100_ID 2 2 1 1 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 26 1 0 ARMSIM_ID 2 1 1 0 ANGEL_ID 2 0 1 0 CMSISDAP_ID 2 2 1 0 GDBSERVER_ID 2 0 1 0 IARROM_ID 2 1 1 0 IJET_ID 2 6 1 0 JLINK_ID 2 15 1 0 LMIFTDI_ID 2 2 1 0 MACRAIGOR_ID 2 3 1 0 PEMICRO_ID 2 1 1 0 RDI_ID 2 2 1 0 STLINK_ID 2 2 1 0 THIRDPARTY_ID 2 0 1 0 XDS100_ID 2 2 1 0 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/iar/dpp-qk.ewp ================================================ 2 Debug ARM 1 General 3 22 1 1 ICCARM 2 31 1 1 AARM 2 9 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 16 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 22 1 0 ICCARM 2 31 1 0 AARM 2 9 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 16 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c nucleo-l152re $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\iar\startup_stm32l1xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qk/iar/dpp-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x08000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20013FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; define symbol __region_EEPROM_start__ = 0x08080000; define symbol __region_EEPROM_end__ = 0x08083FFF; define region EEPROM_region = mem:[from __region_EEPROM_start__ to __region_EEPROM_end__]; place in EEPROM_region { section .eeprom }; ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::STM32L152_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numberical value of the heap size. Startup Code ============ The startup code for the STM32L1xx MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s The file startup_stm32l1xx.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** Adjusting the CPU Clock Speed ============================= The current setting is to run at 2MHz from the MSI (internal oscillator), but the CPU clock speed can be modified by editing the file system_stm32l1xx.c. Ther file system_stm32l1xx_pll.c provides an example of clock setting using the PLL driven from the MSE. *** NOTE: The NUCLEO boards have a wide range of possible clock selections, depending on the solder bridge configuration. Please see Chapter 5.7 "OSC clock" in the STM32 NUCLEO Boards User Manual (ST document UM1724) for more information. *** ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/armclang/dpp-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 dpp-dbg 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ST-LINKIII-KEIL_SWO -U066EFF495056805087184715 -I0 -O8398 -S1 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM) 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 dpp-rel 0x4 ARM-ADS 12000000 1 1 0 1 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 18 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 5 STLink\ST-LINKIII-KEIL_SWO.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 DLGUARM (105=-1,-1,-1,-1,0) 0 ST-LINKIII-KEIL_SWO -U066EFF495056805087184715 -I0 -O8430 -S1 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM) 0 UL2CM3 UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Application 1 0 0 0 1 1 5 0 0 0 ..\..\bsp.h bsp.h 0 0 1 2 5 0 0 0 ..\..\dpp.h dpp.h 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 1 0 0 0 ..\..\philo.c philo.c 0 0 1 5 5 0 0 0 ..\..\README.txt README.txt 0 0 1 6 1 0 0 0 ..\..\table.c table.c 0 0 1 7 1 0 0 0 ..\bsp.c bsp.c 0 0 nucleo-l152re 1 0 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt README.txt 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h stm32l1xx.h 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.c 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h system_stm32l1xx.h 0 0 2 12 2 0 0 0 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s startup_stm32l1xx.s 0 0 QP 1 0 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 16 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 17 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/armclang/dpp-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
dpp-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L152RE STMicroelectronics Keil.STM32L1xx_DFP.1.0.2 http://www.keil.com/pack/ IROM(0x08000000,0x80000) IRAM(0x20000000,0x14000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 $$Device:STM32L152RE$Device\Include\STM32L1xx.h $$Device:STM32L152RE$SVD\STM32L1xx.svd 0 0 0 0 0 0 1 .\dbg\ dpp-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\dpp-qv.bin .\dbg\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 1 0x8000000 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include; ..\..\..\..\..\3rd_party\nucleo-l152re 1 0 0 0 0 0 0 1 0 0 Stack_Size=512 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Application bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c README.txt 5 ..\..\README.txt table.c 1 ..\..\table.c bsp.c 1 ..\bsp.c nucleo-l152re README.txt 5 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h system_stm32l1xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h startup_stm32l1xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c dpp-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 STM32L152RE STMicroelectronics Keil.STM32L1xx_DFP.1.0.2 http://www.keil.com/pack/ IROM(0x08000000,0x80000) IRAM(0x20000000,0x14000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32L1xx_512 -FS08000000 -FL080000 -FP0($$Device:STM32L152RE$Flash\STM32L1xx_512.FLM)) 0 $$Device:STM32L152RE$Device\Include\STM32L1xx.h $$Device:STM32L152RE$SVD\STM32L1xx.svd 0 0 0 0 0 0 1 .\rel\ dpp-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\dpp-qv.bin .\rel\dpp-qv.axf 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL -MPU TCM.DLL -pCM3 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M3" 0 0 0 1 1 0 0 0 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 1 0x8000000 0x80000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x8000000 0x80000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x14000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include; ..\..\..\..\..\3rd_party\nucleo-l152re 1 0 0 0 0 0 0 1 0 0 Stack_Size=512 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 dpp-qv.sct --entry Reset_Handler Application bsp.h 5 ..\..\bsp.h dpp.h 5 ..\..\dpp.h main.c 1 ..\..\main.c philo.c 1 ..\..\philo.c README.txt 5 ..\..\README.txt table.c 1 ..\..\table.c bsp.c 1 ..\bsp.c nucleo-l152re README.txt 5 ..\..\..\..\..\3rd_party\nucleo-l152re\README.txt stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h system_stm32l1xx.c 1 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c system_stm32l1xx.h 5 ..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h startup_stm32l1xx.s 2 ..\..\..\..\..\3rd_party\nucleo-l152re\arm\startup_stm32l1xx.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP on STM32 NUCLEO-L152RE board, cooperative QV kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "stm32l1xx.h" /* CMSIS-compliant header file for the MCU used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIOPORTA_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); /* Local-scope objects -----------------------------------------------------*/ /* LED pins available on the board (just one user LED LD2--Green on PA.5) */ #define LED_LD2 (1U << 5) /* Button pins available on the board (just one user Button B1 on PC.13) */ #define BTN_B1 (1U << 13) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOC->IDR; /* read Port C with the state of Button B1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_B1) != 0U) { /* debounced B1 state changed? */ if ((buttons.depressed & BTN_B1) != 0U) { /* is B1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() has been already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* enable GPIOA clock port for the LED LD2 */ RCC->AHBENR |= (1U << 0); /* configure LED (PA.5) pin as push-pull output, no pull-up, pull-down */ GPIOA->MODER &= ~((3U << 2*5)); GPIOA->MODER |= ((1U << 2*5)); GPIOA->OTYPER &= ~((1U << 5)); GPIOA->OSPEEDR &= ~((3U << 2*5)); GPIOA->OSPEEDR |= ((1U << 2*5)); GPIOA->PUPDR &= ~((3U << 2*5)); /* enable GPIOC clock port for the Button B1 */ RCC->AHBENR |= (1U << 2); /* configure Button (PC.13) pins as input, no pull-up, pull-down */ GPIOC->MODER &= ~(3U << 2*13); GPIOC->OSPEEDR &= ~(3U << 2*13); GPIOC->OSPEEDR |= (1U << 2*13); GPIOC->PUPDR &= ~(3U << 2*13); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { GPIOA->BSRRL |= LED_LD2; /* turn LED on */ } else { GPIOA->BSRRH |= LED_LD2; /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enough LEDs to implement this feature */ if (paused != (uint8_t)0) { //GPIOA->BSRRL |= LED_LD2; /* turn LED on */ } else { //GPIOA->BSRRH |= LED_LD2; /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle an LED on and then off (not enough LEDs, see NOTE01) */ //GPIOA->BSRRL |= LED_LD2; /* turn LED on */ //GPIOA->BSRRH |= LED_LD2; /* turn LED off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ /* !!!CAUTION!!! * The WFI instruction stops the CPU clock, which unfortunately disables * the JTAG port, so the ST-Link debugger can no longer connect to the * board. For that reason, the call to __WFI() has to be used with CAUTION. * * NOTE: If you find your board "frozen" like this, strap BOOT0 to VDD and * reset the board, then connect with ST-Link Utilities and erase the part. * The trick with BOOT(0) is it gets the part to run the System Loader * instead of your broken code. When done disconnect BOOT0, and start over. */ //QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ QF_INT_ENABLE(); /* for now, just enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/gnu/.cproject ================================================ ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/gnu/.project ================================================ dpp-qv_nucleo-l152re org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/arm-cm/qv/gnu QV 2 PARENT-5-PROJECT_LOC/src/qvn bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h main.c 1 PARENT-2-PROJECT_LOC/main.c nucleo-l152re 2 PARENT-5-PROJECT_LOC/3rd_party/nucleo-l152re philo.c 1 PARENT-2-PROJECT_LOC/philo.c qstamp.c 1 PARENT-5-PROJECT_LOC/include/qstamp.c table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on NUCLEO-L152RE, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/nucleo-l152re \ $(QPN)/3rd_party/nucleo-l152re/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/nucleo-l152re #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c \ system_stm32l1xx.c \ startup_stm32l1xx.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m3 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := FLOAT_ABI := #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/gnu/dpp-qv.ld ================================================ /***************************************************************************** * Product: Linker script for for STM32L152RET6, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of STM32L152RET6 */ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/iar/dpp-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/iar/dpp-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c nucleo-l152re $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\iar\startup_stm32l1xx.s $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\stm32l1xx.h $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.c $PROJ_DIR$\..\..\..\..\..\3rd_party\nucleo-l152re\system_stm32l1xx.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/qv/iar/dpp-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x08000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20013FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in RAM_region { readwrite, block CSTACK, block HEAP }; define symbol __region_EEPROM_start__ = 0x08080000; define symbol __region_EEPROM_end__ = 0x08083FFF; define region EEPROM_region = mem:[from __region_EEPROM_start__ to __region_EEPROM_end__]; place in EEPROM_region { section .eeprom }; ================================================ FILE: examples/arm-cm/dpp_nucleo-l152re/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/README.txt ================================================ About this Example ================== This directory contains the "Fly 'n' Shoot" game example application for the EFM32-SLSTK3401A board (Pearl Gecko evaluation kit) board. This directory contains portable code that should compile with any C compiler for ARM Cortex-M. The sub-directories contain code and project files, which are specific to the particular ARM toolchains, such as ARM (MDK-ARM), GCC, and IAR. Please refer to the README files in the sub-directories for specific instructions how to use and customize the example to your needs. Support Code for EFM32-SLSTK3401A Board ======================================= The directory qpc\3rd_party\efm32pg1b\ contains the CMSIS-compliant device code for the LM3S811 MCU. Please see the README file in this folder for more details. QS Software Tracing Instrumentation ----------------------------------- The Blinky example provides the "Spy" build configuration, which outputs the QS (Quantum Spy) software tracing data through UART0, which is connected to the virtual COM port of the TI Stellaris debugger. The output is generated at 115200 baud rate. Here is an example invocation of the QSPY host application to receive the QS data from EFM32-SLSTK3401A: qspy -cCOM1 The actual COM port number might be different on your Windows machine. Please check the Device Manager to find the COM port number. Win32 Emulations ================ The sub-directorie win32 and win32-qv provide the emulations of the example on Windows GUI (with regular Win32 threads and with cooperative QV scheduler, respectively. These sub-directories contain the Makefiles for the MinGW toolset and Visual Studio solution files (game-gui.sln) for Visual C++. The Win32 emulations use exactly the same code as the embedded board and differ only in the Board Support Package (bsp.c). This examples demonstrate the "dual targeting" development approach, where most of the embedded code is developed on the desktop machine (Windows), but is intended for a deeply embedded target (EFM32-SLSTK3401A here). ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_game_efm32-slstk3401a.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/bsp.h ================================================ /***************************************************************************** * Product: "Fly 'n' Shoot" game example on EFM32-SLSTK3401A board * Last updated for version 5.6.5 * Last updated on 2016-06-02 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 33U #define BSP_SCREEN_WIDTH 128U #define BSP_SCREEN_HEIGHT 128U void BSP_init(void); void BSP_terminate(int16_t result); void BSP_updateScreen(void); void BSP_clearFB(void); void BSP_clearWalls(void); void BSP_paintString(uint8_t x, uint8_t y, char const *str); void BSP_paintBitmap(uint8_t x, uint8_t y, uint8_t bmp_id); void BSP_advanceWalls(uint8_t top, uint8_t bottom); void BSP_updateScore(uint16_t score); bool BSP_isThrottle(void); /* is the throttle button depressed? */ bool BSP_doBitmapsOverlap(uint8_t bmp_id1, uint8_t x1, uint8_t y1, uint8_t bmp_id2, uint8_t x2, uint8_t y2); bool BSP_isWallHit(uint8_t bmp_id, uint8_t x, uint8_t y); void BSP_displayOn(void); void BSP_displayOff(void); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/game.h ================================================ /*.$file${.::game.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::game.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::game.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef GAME_H #define GAME_H enum GameSignals { /* signals used in the game */ TIME_TICK_SIG = Q_USER_SIG, /* published from tick ISR */ PLAYER_TRIGGER_SIG, /* posted by Player (ISR) to trigger the Missile */ PLAYER_QUIT_SIG, /* posted by Player (ISR) to quit the game */ GAME_OVER_SIG, /* posted by Ship when it finishes exploding */ PLAYER_SHIP_MOVE_SIG, /* posted by Player (ISR) to the Ship to move it */ TAKE_OFF_SIG, /* from Tunnel to Ship to grant permission to take off */ HIT_WALL_SIG, /* from Tunnel to Ship when Ship hits the wall */ HIT_MINE_SIG, /* from Mine to Ship or Missile when it hits the mine */ SHIP_IMG_SIG, /* from Ship to the Tunnel to draw and check for hits */ MISSILE_IMG_SIG, /* from Missile the Tunnel to draw and check for hits */ MINE_IMG_SIG, /* posted by Mine to the Tunnel to draw the mine */ MISSILE_FIRE_SIG, /* posted by Ship to the Missile to fire */ DESTROYED_MINE_SIG, /* from Missile to Ship when Missile destroyed Mine */ EXPLOSION_SIG, /* from any exploding object to render the explosion */ MINE_PLANT_SIG, /* from Tunnel to the Mine to plant it */ MINE_DISABLED_SIG,/* from Mine to Tunnel when it becomes disabled */ MINE_RECYCLE_SIG, /* posted by Tunnel to Mine to recycle the mine */ SCORE_SIG /* from Ship to Tunnel to adjust game level based on score */ }; /* active objects ..........................................................*/ extern struct Tunnel AO_Tunnel; extern struct Ship AO_Ship; extern struct Missile AO_Missile; /*.$declare${AOs::Tunnel_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Tunnel_ctor} .....................................................*/ void Tunnel_ctor(void); /*.$enddecl${AOs::Tunnel_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Ship_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Ship_ctor} .......................................................*/ void Ship_ctor(void); /*.$enddecl${AOs::Ship_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Missile_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Missile_ctor} ....................................................*/ void Missile_ctor(uint8_t speed); /*.$enddecl${AOs::Missile_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* common constants and shared helper functions ............................*/ #define GAME_TUNNEL_WIDTH BSP_SCREEN_WIDTH #define GAME_TUNNEL_HEIGHT (BSP_SCREEN_HEIGHT - 10U) #define GAME_MINES_MAX 5U #define GAME_MINES_DIST_MIN 10U #define GAME_SPEED_X 1U #define GAME_MISSILE_SPEED_X 2U #define GAME_SHIP_X 10U #define GAME_SHIP_Y (GAME_TUNNEL_HEIGHT / 2U) #define GAME_WALLS_GAP_Y 50U #define GAME_WALLS_MIN_GAP_Y 20U enum GameBitmapIds { SHIP_BMP, MISSILE_BMP, MINE1_BMP, MINE2_BMP, MINE2_MISSILE_BMP, EXPLOSION0_BMP, EXPLOSION1_BMP, EXPLOSION2_BMP, EXPLOSION3_BMP, MAX_BMP }; /* instantiation of the Mines orthogonal components */ /*.$declare${AOs::Mine1_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine1_ctor} ......................................................*/ QHsm * Mine1_ctor(uint8_t id); /*.$enddecl${AOs::Mine1_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Mine2_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine2_ctor} ......................................................*/ QHsm * Mine2_ctor(uint8_t id); /*.$enddecl${AOs::Mine2_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* GAME_H */ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/game.qm ================================================ "Fly 'n' Shoot" game model from Chapters 1 & 9 of PSiCC2 NOTE: Requries QP5. Tunnel Active Object uint32_t rnd; rnd = (BSP_random() & 0xFFU); /* reduce the top wall thickness 18.75% of the time */ if ((rnd < 48U) && (me->wall_thickness_top > 0U)) { --me->wall_thickness_top; } /* reduce the bottom wall thickness 18.75% of the time */ if ((rnd > 208U) && (me->wall_thickness_bottom > 0U)) { --me->wall_thickness_bottom; } rnd = (BSP_random() & 0xFFU); /* grow the bottom wall thickness 19.14% of the time */ if ((rnd < 49U) && ((GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom) > me->wall_gap)) { ++me->wall_thickness_bottom; } /* grow the top wall thickness 19.14% of the time */ if ((rnd > 207U) && ((GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom) > me->wall_gap)) { ++me->wall_thickness_top; } /* advance the Tunnel by 1 game step to the left * and copy the Tunnel layer to the main frame buffer */ BSP_advanceWalls(me->wall_thickness_top, me->wall_thickness_bottom); uint32_t rnd = (BSP_random() & 0xFFU); if (me->last_mine_x > 0U) { --me->last_mine_x; /* shift the last Mine 1 position to the left */ } /* last mine far enough? */ if ((me->last_mine_x + GAME_MINES_DIST_MIN < GAME_TUNNEL_WIDTH) && (rnd < 8U)) /* place the mines only 5% of the time */ { uint8_t n; for (n = 0U; n < Q_DIM(me->mines); ++n) { /*look for disabled mines */ if (me->mines[n] == (QHsm *)0) { break; } } if (n < Q_DIM(me->mines)) { /* a disabled Mine found? */ rnd = (BSP_random() & 0xFFFFU); if ((rnd & 1U) == 0U) { /* choose the type of the mine */ me->mines[n] = me->mine1_pool[n]; } else { me->mines[n] = me->mine2_pool[n]; } /* new Mine is planted by the end of the tunnel */ me->last_mine_x = GAME_TUNNEL_WIDTH - 8U; /* choose a random y-position for the Mine in the Tunnel */ rnd %= (GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom - 4U); me->last_mine_y = (uint8_t)(me->wall_thickness_top + 2U + rnd); Q_SIG(me->mines[n]) = MINE_PLANT_SIG; Q_PAR(me->mines[n]) = (me->last_mine_x | (me->last_mine_y << 8)); QHSM_DISPATCH(me->mines[n]); /* direct dispatch */ } } uint8_t n; for (n = 0; n < GAME_MINES_MAX; ++n) { if (me->mines[n] != (QHsm *)0) { /* is the mine used? */ Q_SIG(me->mines[n]) = sig; Q_PAR(me->mines[n]) = par; QHSM_DISPATCH(me->mines[n]); } } uint8_t n; for (n = 0; n < GAME_MINES_MAX; ++n) { QHSM_INIT(me->mine1_pool[n]); /* initial tran. for Mine1 */ QHSM_INIT(me->mine2_pool[n]); /* initial tran. for Mine2 */ } BSP_randomSeed(1234U); /* seed the pseudo-random generator */ Q_ASSERT((Q_PAR(me) < GAME_MINES_MAX) && (me->mines[Q_PAR(me)] != (QHsm *)0)); me->mines[Q_PAR(me)] = (QHsm *)0; QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 10U; BSP_paintString(24U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "Quantum LeAps"); BSP_paintString(16U, (GAME_TUNNEL_HEIGHT / 2U) + 0U, "state-machine.com"); BSP_paintString(1U, GAME_TUNNEL_HEIGHT - 18U, "Fire missile: BTN0"); BSP_paintString(1U, GAME_TUNNEL_HEIGHT - 10U, "Fly ship up: BTN1"); BSP_updateScreen(); QActive_disarmX(&me->super, 0U); --me->blink_ctr; /* toggle the blink couner */ me->blink_ctr == 0U else BSP_paintString(24U + 8U*6U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "LeaPs"); BSP_updateScreen(); (me->blink_ctr & 1U) != 0U BSP_paintString(24U + 8U*6U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "LeAps"); BSP_updateScreen(); me->last_mine_x = 0U; /* last mine at right edge of the tunnel */ me->last_mine_y = 0U; /* set the tunnel properties... */ me->wall_thickness_top = 0U; me->wall_thickness_bottom = 0U; me->wall_gap = GAME_WALLS_GAP_Y; /* clear the tunnel walls */ BSP_clearWalls(); QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 20U*2U; /* 20s timeout total */ QActive_disarmX(&me->super, 0U); Tunnel_advance(me); if (me->blink_ctr != 0U) { /* add the text bitmap into the frame buffer */ BSP_paintString((GAME_TUNNEL_WIDTH - 10U*6U)/2U, (GAME_TUNNEL_HEIGHT - 4U)/2U, "Press BTN0"); } BSP_updateScreen(); --me->blink_ctr; me->blink_ctr == 0 me->wall_gap = GAME_WALLS_GAP_Y; QACTIVE_POST(&AO_Ship, TAKE_OFF_SIG, 0); Tunnel_dispatchToAllMines(me, MINE_RECYCLE_SIG, 0); /* render this frame on the display */ BSP_updateScreen(); Tunnel_advance(me); Tunnel_plantMine(me); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /* did the Ship/Missile hit the tunnel wall? */ if (BSP_isWallHit(bmp, x, y)) { QACTIVE_POST(&AO_Ship, HIT_WALL_SIG, 0); } BSP_paintBitmap(x, y, bmp); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /* did the Ship/Missile hit the tunnel wall? */ if (BSP_isWallHit(bmp, x, y)) { QACTIVE_POST(&AO_Missile, HIT_WALL_SIG, 0); } BSP_paintBitmap(x, y, bmp); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); BSP_paintBitmap((uint8_t)Q_PAR(me), (uint8_t)(Q_PAR(me) >> 8), (uint8_t)(Q_PAR(me) >> 16)); BSP_paintBitmap((uint8_t)Q_PAR(me), (uint8_t)(Q_PAR(me) >> 8), (uint8_t)(Q_PAR(me) >> 16)); BSP_updateScore((uint16_t)Q_PAR(me)); /* increase difficulty of the game: * the tunnel gets narrower as the score goes up */ me->wall_gap = (uint8_t)(GAME_WALLS_GAP_Y - (uint16_t)Q_PAR(me)/100U); if (me->wall_gap < GAME_WALLS_MIN_GAP_Y) { me->wall_gap = GAME_WALLS_MIN_GAP_Y; } BSP_clearWalls(); BSP_updateScore((uint16_t)Q_PAR(me)); BSP_updateScreen(); QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 5U*2U; /* 5s timeout */ BSP_paintString((GAME_TUNNEL_WIDTH - 6U * 9U) / 2U, (GAME_TUNNEL_HEIGHT / 2U) - 4U, "Game Over"); BSP_updateScreen(); QActive_disarmX(&me->super, 0U); BSP_updateScore(0); /* update the score on the display */ --me->blink_ctr; BSP_paintString((GAME_TUNNEL_WIDTH - 6U*9U) / 2U, (GAME_TUNNEL_HEIGHT / 2U) - 4U, (((me->blink_ctr & 1) != 0) ? "Game Over" : " ")); BSP_updateScreen(); me->blink_ctr == 0 BSP_displayOff(); /* power down the display */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC*3U, 0U); /* 3 sec */ QActive_disarmX(&me->super, 0U); BSP_displayOn(); /* power up the display */ uint32_t rnd = BSP_random(); /* clear the screen frame buffer */ BSP_clearFB(); BSP_paintString((uint8_t)(rnd % (GAME_TUNNEL_WIDTH - 10U*6U)), (uint8_t) (rnd % (GAME_TUNNEL_HEIGHT - 8U)), "Press BTN0"); BSP_updateScreen(); QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/3U, 0U);/* 1/3 sec */ QActive_disarmX(&me->super, 0U); BSP_clearFB(); BSP_updateScreen(); /* clear the screen */ BSP_clearFB(); BSP_updateScreen(); QF_stop(); /* stop QF and cleanup */ Ship Active Object fixed point in 14s2 representation me->score = 0; /* reset the score */ QACTIVE_POST(&AO_Tunnel, SCORE_SIG, me->score); /* lauch the ship from the initial position */ me->x = GAME_SHIP_X; me->y = (GAME_SHIP_Y << 2); /* move the Ship up or down depending on the button state */ if (BSP_isThrottle()) { if (me->y > 0) { me->y -= 1U; } } else { if (me->y < (GAME_TUNNEL_HEIGHT << 2)) { me->y += 1U; } } /* tell the Tunnel to draw the Ship and test for hits */ QACTIVE_POST(&AO_Tunnel, SHIP_IMG_SIG, (SHIP_BMP << 16) | me->x | ((me->y >> 2) << 8)); ++me->score; /* increment the score for surviving another tick */ if ((me->score % 10) == 0) { /* is the score "round"? */ QACTIVE_POST(&AO_Tunnel, SCORE_SIG, me->score); } QACTIVE_POST(&AO_Missile, MISSILE_FIRE_SIG, me->x | (((me->y >> 2) - 1 + SHIP_HEIGHT) & 0xFFU) << 8); me->score += (uint16_t)Q_PAR(me); /* the score will be sent to the Tunnel by the next TIME_TICK */ me->exp_ctr = 0; me->exp_ctr < 15 ++me->exp_ctr; /* tell the Tunnel to draw the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | me->x | ((((me->y >> 2) - 4U + SHIP_HEIGHT) & 0xFFU) << 8)); else QACTIVE_POST(&AO_Tunnel, GAME_OVER_SIG, me->score); Missile Active Object me->x = (uint8_t)Q_PAR(me); /* init position from the Ship */ me->y = (uint8_t)(Q_PAR(me) >> 8); me->x + GAME_MISSILE_SPEED_X < GAME_TUNNEL_WIDTH me->x += me->speed; /*tell the Tunnel to draw the Missile and test for wall hits*/ QACTIVE_POST(&AO_Tunnel, MISSILE_IMG_SIG, (MISSILE_BMP << 16) | me->x | (me->y << 8)); else /* tell the Ship the score for destroing this Mine */ QACTIVE_POST(&AO_Ship, Q_SIG(me), Q_PAR(me)); /* re-arm immediately & let the destroyed Mine do the exploding */ me->exp_ctr = 0; (me->x >= GAME_SPEED_X) && (me->exp_ctr < 15) ++me->exp_ctr; /* advance the explosion counter */ me->x -= me->speed; /* move the explosion by one step */ /* tell the Tunnel to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 3) | ((int)me->y - 4) << 8); else /* explosion finished or moved outside the game */ The Mine1 orthogonal component me->x = (uint8_t)Q_PAR(me); me->y = (uint8_t)(Q_PAR(me) >> 8); /* tell the Tunnel that this mine is becoming disabled */ QACTIVE_POST(&AO_Tunnel, MINE_DISABLED_SIG, MINE_ID(me)); me->x >= GAME_SPEED_X me->x -= GAME_SPEED_X; /* move the mine 1 step */ /* tell the Tunnel to draw the Mine */ QACTIVE_POST(&AO_Tunnel, MINE_IMG_SIG, (MINE1_BMP << 16) | me->x | (me->y << 8)); else uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); BSP_doBitmapsOverlap(MINE1_BMP, me->x, me->y, bmp, x, y) QACTIVE_POST(&AO_Ship, HIT_MINE_SIG, 1); /* go straight to 'disabled' and let the Ship do * the exploding */ uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); BSP_doBitmapsOverlap(MINE1_BMP, me->x, me->y, bmp, x, y) /* post the score for destroying Mine type-1 */ QACTIVE_POST(&AO_Missile, DESTROYED_MINE_SIG, 25); me->exp_ctr = 0; (me->x >= GAME_SPEED_X) && (me->exp_ctr < 15) ++me->exp_ctr; /* advance the explosion counter */ me->x -= GAME_SPEED_X; /* move explosion by 1 step */ /* tell the Game to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 1) | (((int)me->y - 4 + 2)) << 8); else The Mine2 orthogonal component me->x = (uint8_t)Q_PAR(me); me->y = (uint8_t)(Q_PAR(me) >> 8); /* tell the Tunnel that this mine is becoming disabled */ QACTIVE_POST(&AO_Tunnel, MINE_DISABLED_SIG, MINE_ID(me)); me->x >= GAME_SPEED_X me->x -= GAME_SPEED_X; /* move the mine 1 step */ /* tell the Tunnel to draw the Mine */ QACTIVE_POST(&AO_Tunnel, MINE_IMG_SIG, (MINE2_BMP << 16) | me->x | (me->y << 8)); else uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); BSP_doBitmapsOverlap(MINE2_BMP, me->x, me->y, bmp, x, y) QACTIVE_POST(&AO_Ship, HIT_MINE_SIG, 2); /* go straight to 'disabled' and let the Ship do the exploding */ uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); BSP_doBitmapsOverlap(MINE2_MISSILE_BMP, me->x, me->y, bmp, x, y) /* NOTE: Mine type-2 is nastier than Mine type-1. * The type-2 mine can hit the Ship with any of its * "tentacles". However, it can be destroyed by the * Missile only by hitting its center, defined as * a smaller bitmap MINE2_MISSILE_BMP. */ /* post the score for destroying Mine type-2 */ QACTIVE_POST(&AO_Missile, DESTROYED_MINE_SIG, 45); me->exp_ctr = 0; (me->x >= GAME_SPEED_X) && (me->exp_ctr < 15) ++me->exp_ctr; /* advance the explosion counter */ me->x -= GAME_SPEED_X; /* move explosion by 1 step */ /* tell the Game to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 1) | (((int)me->y - 4 + 2)) << 8); else uint8_t n; Tunnel *me = &AO_Tunnel; QActive_ctor(&me->super, Q_STATE_CAST(&Tunnel_initial)); for (n = 0; n < GAME_MINES_MAX; ++n) { me->mine1_pool[n] = Mine1_ctor(n); /* instantiate Mine1 in the pool */ me->mine2_pool[n] = Mine2_ctor(n); /* instantiate Mine2 in the pool */ me->mines[n] = (QHsm *)0; /* mine 'n' is unused */ } me->last_mine_x = 0; /* the last mine at the right edge of the tunnel */ me->last_mine_y = 0; Ship *me = &AO_Ship; QActive_ctor(&me->super, Q_STATE_CAST(&Ship_initial)); me->x = GAME_SHIP_X; me->y = (GAME_SHIP_Y << 2); Missile *me = &AO_Missile; QActive_ctor(&me->super, Q_STATE_CAST(&Missile_initial)); me->speed = speed; Mine1 *me; Q_REQUIRE(id < GAME_MINES_MAX); me = &l_mine1[id]; QHsm_ctor(&me->super, Q_STATE_CAST(&Mine1_initial)); return &me->super; Mine2 *me; Q_REQUIRE(id < GAME_MINES_MAX); me = &l_mine2[id]; QHsm_ctor(&me->super, Q_STATE_CAST(&Mine2_initial)); return &me->super; #ifndef GAME_H #define GAME_H enum GameSignals { /* signals used in the game */ TIME_TICK_SIG = Q_USER_SIG, /* published from tick ISR */ PLAYER_TRIGGER_SIG, /* posted by Player (ISR) to trigger the Missile */ PLAYER_QUIT_SIG, /* posted by Player (ISR) to quit the game */ GAME_OVER_SIG, /* posted by Ship when it finishes exploding */ PLAYER_SHIP_MOVE_SIG, /* posted by Player (ISR) to the Ship to move it */ TAKE_OFF_SIG, /* from Tunnel to Ship to grant permission to take off */ HIT_WALL_SIG, /* from Tunnel to Ship when Ship hits the wall */ HIT_MINE_SIG, /* from Mine to Ship or Missile when it hits the mine */ SHIP_IMG_SIG, /* from Ship to the Tunnel to draw and check for hits */ MISSILE_IMG_SIG, /* from Missile the Tunnel to draw and check for hits */ MINE_IMG_SIG, /* posted by Mine to the Tunnel to draw the mine */ MISSILE_FIRE_SIG, /* posted by Ship to the Missile to fire */ DESTROYED_MINE_SIG, /* from Missile to Ship when Missile destroyed Mine */ EXPLOSION_SIG, /* from any exploding object to render the explosion */ MINE_PLANT_SIG, /* from Tunnel to the Mine to plant it */ MINE_DISABLED_SIG,/* from Mine to Tunnel when it becomes disabled */ MINE_RECYCLE_SIG, /* posted by Tunnel to Mine to recycle the mine */ SCORE_SIG /* from Ship to Tunnel to adjust game level based on score */ }; /* active objects ..........................................................*/ extern struct Tunnel AO_Tunnel; extern struct Ship AO_Ship; extern struct Missile AO_Missile; $declare(AOs::Tunnel_ctor) $declare(AOs::Ship_ctor) $declare(AOs::Missile_ctor) /* common constants and shared helper functions ............................*/ #define GAME_TUNNEL_WIDTH BSP_SCREEN_WIDTH #define GAME_TUNNEL_HEIGHT (BSP_SCREEN_HEIGHT - 10U) #define GAME_MINES_MAX 5U #define GAME_MINES_DIST_MIN 10U #define GAME_SPEED_X 1U #define GAME_MISSILE_SPEED_X 2U #define GAME_SHIP_X 10U #define GAME_SHIP_Y (GAME_TUNNEL_HEIGHT / 2U) #define GAME_WALLS_GAP_Y 50U #define GAME_WALLS_MIN_GAP_Y 20U enum GameBitmapIds { SHIP_BMP, MISSILE_BMP, MINE1_BMP, MINE2_BMP, MINE2_MISSILE_BMP, EXPLOSION0_BMP, EXPLOSION1_BMP, EXPLOSION2_BMP, EXPLOSION3_BMP, MAX_BMP }; /* instantiation of the Mines orthogonal components */ $declare(AOs::Mine1_ctor) $declare(AOs::Mine2_ctor) #endif /* GAME_H */ #include "qpn.h" #include "game.h" #include "bsp.h" /* Q_DEFINE_THIS_MODULE("missile") */ /* encapsulated delcaration of the Missile active object -------------------*/ $declare(AOs::Missile) /* global objects ----------------------------------------------------------*/ Missile AO_Missile; /* Active object definition ------------------------------------------------*/ $define(AOs::Missile_ctor) $define(AOs::Missile) #include "qpn.h" #include "game.h" #include "bsp.h" /* Q_DEFINE_THIS_MODULE(ship) */ #define SHIP_WIDTH 5U #define SHIP_HEIGHT 3U /* encapsulated delcaration of the Ship active object ----------------------*/ $declare(AOs::Ship) /* global objects ----------------------------------------------------------*/ Ship AO_Ship; /* Active object definition ------------------------------------------------*/ $define(AOs::Ship_ctor) $define(AOs::Ship) #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("tunnel") /* local objects -----------------------------------------------------------*/ $declare(AOs::Tunnel) /* global objects ----------------------------------------------------------*/ Tunnel AO_Tunnel; /* Active object definition ================================================*/ $define(AOs::Tunnel_ctor) $define(AOs::Tunnel) #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("mine1") /* encapsulated delcaration of the Mine1 HSM -------------------------------*/ $declare(AOs::Mine1) /* local objects -----------------------------------------------------------*/ static Mine1 l_mine1[GAME_MINES_MAX]; /* a pool of type-1 mines */ /* helper macro to provide the ID of this mine */ #define MINE_ID(me_) ((me_) - l_mine1) /* Mine1 class definition --------------------------------------------------*/ $define(AOs::Mine1_ctor) $define(AOs::Mine1) #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("mine2") /* encapsulated delcaration of the Mine2 HSM -------------------------------*/ $declare(AOs::Mine2) /* local objects -----------------------------------------------------------*/ static Mine2 l_mine2[GAME_MINES_MAX]; /* a pool of type-2 mines */ /* helper macro to provide the ID of this mine */ #define MINE_ID(me_) ((me_) - l_mine2) /* Mine2 class definition --------------------------------------------------*/ $define(AOs::Mine2_ctor) $define(AOs::Mine2) ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/main.c ================================================ /***************************************************************************** * Product: "Fly 'n' Shoot" game example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "game.h" /* Game application */ #include "bsp.h" /* Board Support Package */ /*..........................................................................*/ static QEvt l_tunnelQueue[GAME_MINES_MAX + 5]; static QEvt l_shipQueue[3]; static QEvt l_missileQueue[3]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Tunnel, l_tunnelQueue, Q_DIM(l_tunnelQueue) }, { (QActive *)&AO_Ship, l_shipQueue, Q_DIM(l_shipQueue) }, { (QActive *)&AO_Missile, l_missileQueue, Q_DIM(l_missileQueue) } }; /*..........................................................................*/ int_t main() { Tunnel_ctor(); Ship_ctor(); Missile_ctor(GAME_MISSILE_SPEED_X); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/mine1.c ================================================ /*.$file${.::mine1.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::mine1.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::mine1.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("mine1") /* encapsulated delcaration of the Mine1 HSM -------------------------------*/ /*.$declare${AOs::Mine1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine1} ...........................................................*/ typedef struct Mine1 { /* protected: */ QHsm super; /* private: */ uint8_t x; uint8_t y; uint8_t exp_ctr; } Mine1; /* protected: */ static QState Mine1_initial(Mine1 * const me); static QState Mine1_unused(Mine1 * const me); static QState Mine1_used(Mine1 * const me); static QState Mine1_planted(Mine1 * const me); static QState Mine1_exploding(Mine1 * const me); /*.$enddecl${AOs::Mine1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* local objects -----------------------------------------------------------*/ static Mine1 l_mine1[GAME_MINES_MAX]; /* a pool of type-1 mines */ /* helper macro to provide the ID of this mine */ #define MINE_ID(me_) ((me_) - l_mine1) /* Mine1 class definition --------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Mine1_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine1_ctor} ......................................................*/ QHsm * Mine1_ctor(uint8_t id) { Mine1 *me; Q_REQUIRE(id < GAME_MINES_MAX); me = &l_mine1[id]; QHsm_ctor(&me->super, Q_STATE_CAST(&Mine1_initial)); return &me->super; } /*.$enddef${AOs::Mine1_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Mine1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine1} ...........................................................*/ /*.${AOs::Mine1::SM} .......................................................*/ static QState Mine1_initial(Mine1 * const me) { /*.${AOs::Mine1::SM::initial} */ return Q_TRAN(&Mine1_unused); } /*.${AOs::Mine1::SM::unused} ...............................................*/ static QState Mine1_unused(Mine1 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine1::SM::unused::MINE_PLANT} */ case MINE_PLANT_SIG: { me->x = (uint8_t)Q_PAR(me); me->y = (uint8_t)(Q_PAR(me) >> 8); status_ = Q_TRAN(&Mine1_planted); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Mine1::SM::used} .................................................*/ static QState Mine1_used(Mine1 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine1::SM::used} */ case Q_EXIT_SIG: { /* tell the Tunnel that this mine is becoming disabled */ QACTIVE_POST(&AO_Tunnel, MINE_DISABLED_SIG, MINE_ID(me)); status_ = Q_HANDLED(); break; } /*.${AOs::Mine1::SM::used::MINE_RECYCLE} */ case MINE_RECYCLE_SIG: { status_ = Q_TRAN(&Mine1_unused); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Mine1::SM::used::planted} ........................................*/ static QState Mine1_planted(Mine1 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine1::SM::used::planted::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Mine1::SM::used::planted::TIME_TICK::[me->x>=GAME_SPEED_X]} */ if (me->x >= GAME_SPEED_X) { me->x -= GAME_SPEED_X; /* move the mine 1 step */ /* tell the Tunnel to draw the Mine */ QACTIVE_POST(&AO_Tunnel, MINE_IMG_SIG, (MINE1_BMP << 16) | me->x | (me->y << 8)); status_ = Q_HANDLED(); } /*.${AOs::Mine1::SM::used::planted::TIME_TICK::[else]} */ else { status_ = Q_TRAN(&Mine1_unused); } break; } /*.${AOs::Mine1::SM::used::planted::SHIP_IMG} */ case SHIP_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /*.${AOs::Mine1::SM::used::planted::SHIP_IMG::[BSP_doBitmapsOverlap(MINE1_BMP,~} */ if (BSP_doBitmapsOverlap(MINE1_BMP, me->x, me->y, bmp, x, y)) { QACTIVE_POST(&AO_Ship, HIT_MINE_SIG, 1); /* go straight to 'disabled' and let the Ship do * the exploding */ status_ = Q_TRAN(&Mine1_unused); } else { status_ = Q_UNHANDLED(); } break; } /*.${AOs::Mine1::SM::used::planted::MISSILE_IMG} */ case MISSILE_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /*.${AOs::Mine1::SM::used::planted::MISSILE_IMG::[BSP_doBitmapsOverlap(MINE1_BMP,~} */ if (BSP_doBitmapsOverlap(MINE1_BMP, me->x, me->y, bmp, x, y)) { /* post the score for destroying Mine type-1 */ QACTIVE_POST(&AO_Missile, DESTROYED_MINE_SIG, 25); status_ = Q_TRAN(&Mine1_exploding); } else { status_ = Q_UNHANDLED(); } break; } default: { status_ = Q_SUPER(&Mine1_used); break; } } return status_; } /*.${AOs::Mine1::SM::used::exploding} ......................................*/ static QState Mine1_exploding(Mine1 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine1::SM::used::exploding} */ case Q_ENTRY_SIG: { me->exp_ctr = 0; status_ = Q_HANDLED(); break; } /*.${AOs::Mine1::SM::used::exploding::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Mine1::SM::used::exploding::TIME_TICK::[(me->x>=GAME_SPEED_X)&&(me->exp~} */ if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15)) { ++me->exp_ctr; /* advance the explosion counter */ me->x -= GAME_SPEED_X; /* move explosion by 1 step */ /* tell the Game to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 1) | (((int)me->y - 4 + 2)) << 8); status_ = Q_HANDLED(); } /*.${AOs::Mine1::SM::used::exploding::TIME_TICK::[else]} */ else { status_ = Q_TRAN(&Mine1_unused); } break; } default: { status_ = Q_SUPER(&Mine1_used); break; } } return status_; } /*.$enddef${AOs::Mine1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/mine2.c ================================================ /*.$file${.::mine2.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::mine2.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::mine2.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("mine2") /* encapsulated delcaration of the Mine2 HSM -------------------------------*/ /*.$declare${AOs::Mine2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine2} ...........................................................*/ typedef struct Mine2 { /* protected: */ QHsm super; /* private: */ uint8_t x; uint8_t y; uint8_t exp_ctr; } Mine2; /* protected: */ static QState Mine2_initial(Mine2 * const me); static QState Mine2_unused(Mine2 * const me); static QState Mine2_used(Mine2 * const me); static QState Mine2_planted(Mine2 * const me); static QState Mine2_exploding(Mine2 * const me); /*.$enddecl${AOs::Mine2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* local objects -----------------------------------------------------------*/ static Mine2 l_mine2[GAME_MINES_MAX]; /* a pool of type-2 mines */ /* helper macro to provide the ID of this mine */ #define MINE_ID(me_) ((me_) - l_mine2) /* Mine2 class definition --------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Mine2_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine2_ctor} ......................................................*/ QHsm * Mine2_ctor(uint8_t id) { Mine2 *me; Q_REQUIRE(id < GAME_MINES_MAX); me = &l_mine2[id]; QHsm_ctor(&me->super, Q_STATE_CAST(&Mine2_initial)); return &me->super; } /*.$enddef${AOs::Mine2_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Mine2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Mine2} ...........................................................*/ /*.${AOs::Mine2::SM} .......................................................*/ static QState Mine2_initial(Mine2 * const me) { /*.${AOs::Mine2::SM::initial} */ return Q_TRAN(&Mine2_unused); } /*.${AOs::Mine2::SM::unused} ...............................................*/ static QState Mine2_unused(Mine2 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine2::SM::unused::MINE_PLANT} */ case MINE_PLANT_SIG: { me->x = (uint8_t)Q_PAR(me); me->y = (uint8_t)(Q_PAR(me) >> 8); status_ = Q_TRAN(&Mine2_planted); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Mine2::SM::used} .................................................*/ static QState Mine2_used(Mine2 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine2::SM::used} */ case Q_EXIT_SIG: { /* tell the Tunnel that this mine is becoming disabled */ QACTIVE_POST(&AO_Tunnel, MINE_DISABLED_SIG, MINE_ID(me)); status_ = Q_HANDLED(); break; } /*.${AOs::Mine2::SM::used::MINE_RECYCLE} */ case MINE_RECYCLE_SIG: { status_ = Q_TRAN(&Mine2_unused); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Mine2::SM::used::planted} ........................................*/ static QState Mine2_planted(Mine2 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine2::SM::used::planted::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Mine2::SM::used::planted::TIME_TICK::[me->x>=GAME_SPEED_X]} */ if (me->x >= GAME_SPEED_X) { me->x -= GAME_SPEED_X; /* move the mine 1 step */ /* tell the Tunnel to draw the Mine */ QACTIVE_POST(&AO_Tunnel, MINE_IMG_SIG, (MINE2_BMP << 16) | me->x | (me->y << 8)); status_ = Q_HANDLED(); } /*.${AOs::Mine2::SM::used::planted::TIME_TICK::[else]} */ else { status_ = Q_TRAN(&Mine2_unused); } break; } /*.${AOs::Mine2::SM::used::planted::SHIP_IMG} */ case SHIP_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /*.${AOs::Mine2::SM::used::planted::SHIP_IMG::[BSP_doBitmapsOverlap(MINE2_BMP,~} */ if (BSP_doBitmapsOverlap(MINE2_BMP, me->x, me->y, bmp, x, y)) { QACTIVE_POST(&AO_Ship, HIT_MINE_SIG, 2); /* go straight to 'disabled' and let the Ship do the exploding */ status_ = Q_TRAN(&Mine2_unused); } else { status_ = Q_UNHANDLED(); } break; } /*.${AOs::Mine2::SM::used::planted::MISSILE_IMG} */ case MISSILE_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /*.${AOs::Mine2::SM::used::planted::MISSILE_IMG::[BSP_doBitmapsOverlap(MINE2_MISS~} */ if (BSP_doBitmapsOverlap(MINE2_MISSILE_BMP, me->x, me->y, bmp, x, y)) { /* NOTE: Mine type-2 is nastier than Mine type-1. * The type-2 mine can hit the Ship with any of its * "tentacles". However, it can be destroyed by the * Missile only by hitting its center, defined as * a smaller bitmap MINE2_MISSILE_BMP. */ /* post the score for destroying Mine type-2 */ QACTIVE_POST(&AO_Missile, DESTROYED_MINE_SIG, 45); status_ = Q_TRAN(&Mine2_exploding); } else { status_ = Q_UNHANDLED(); } break; } default: { status_ = Q_SUPER(&Mine2_used); break; } } return status_; } /*.${AOs::Mine2::SM::used::exploding} ......................................*/ static QState Mine2_exploding(Mine2 * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Mine2::SM::used::exploding} */ case Q_ENTRY_SIG: { me->exp_ctr = 0; status_ = Q_HANDLED(); break; } /*.${AOs::Mine2::SM::used::exploding::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Mine2::SM::used::exploding::TIME_TICK::[(me->x>=GAME_SPEED_X)&&(me->exp~} */ if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15)) { ++me->exp_ctr; /* advance the explosion counter */ me->x -= GAME_SPEED_X; /* move explosion by 1 step */ /* tell the Game to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 1) | (((int)me->y - 4 + 2)) << 8); status_ = Q_HANDLED(); } /*.${AOs::Mine2::SM::used::exploding::TIME_TICK::[else]} */ else { status_ = Q_TRAN(&Mine2_unused); } break; } default: { status_ = Q_SUPER(&Mine2_used); break; } } return status_; } /*.$enddef${AOs::Mine2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/missile.c ================================================ /*.$file${.::missile.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::missile.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::missile.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "game.h" #include "bsp.h" /* Q_DEFINE_THIS_MODULE("missile") */ /* encapsulated delcaration of the Missile active object -------------------*/ /*.$declare${AOs::Missile} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Missile} .........................................................*/ typedef struct Missile { /* protected: */ QActive super; /* private: */ uint8_t x; uint8_t y; uint8_t exp_ctr; /* public: */ uint8_t speed; } Missile; /* protected: */ static QState Missile_initial(Missile * const me); static QState Missile_armed(Missile * const me); static QState Missile_flying(Missile * const me); static QState Missile_exploding(Missile * const me); /*.$enddecl${AOs::Missile} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* global objects ----------------------------------------------------------*/ Missile AO_Missile; /* Active object definition ------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Missile_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Missile_ctor} ....................................................*/ void Missile_ctor(uint8_t speed) { Missile *me = &AO_Missile; QActive_ctor(&me->super, Q_STATE_CAST(&Missile_initial)); me->speed = speed; } /*.$enddef${AOs::Missile_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Missile} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Missile} .........................................................*/ /*.${AOs::Missile::SM} .....................................................*/ static QState Missile_initial(Missile * const me) { /*.${AOs::Missile::SM::initial} */ return Q_TRAN(&Missile_armed); } /*.${AOs::Missile::SM::armed} ..............................................*/ static QState Missile_armed(Missile * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Missile::SM::armed::MISSILE_FIRE} */ case MISSILE_FIRE_SIG: { me->x = (uint8_t)Q_PAR(me); /* init position from the Ship */ me->y = (uint8_t)(Q_PAR(me) >> 8); status_ = Q_TRAN(&Missile_flying); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Missile::SM::flying} .............................................*/ static QState Missile_flying(Missile * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Missile::SM::flying::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Missile::SM::flying::TIME_TICK::[me->x+GAME_MISSILE_SPEED_Xx + GAME_MISSILE_SPEED_X < GAME_TUNNEL_WIDTH) { me->x += me->speed; /*tell the Tunnel to draw the Missile and test for wall hits*/ QACTIVE_POST(&AO_Tunnel, MISSILE_IMG_SIG, (MISSILE_BMP << 16) | me->x | (me->y << 8)); status_ = Q_HANDLED(); } /*.${AOs::Missile::SM::flying::TIME_TICK::[else]} */ else { status_ = Q_TRAN(&Missile_armed); } break; } /*.${AOs::Missile::SM::flying::HIT_WALL} */ case HIT_WALL_SIG: { status_ = Q_TRAN(&Missile_exploding); break; } /*.${AOs::Missile::SM::flying::DESTROYED_MINE} */ case DESTROYED_MINE_SIG: { /* tell the Ship the score for destroing this Mine */ QACTIVE_POST(&AO_Ship, Q_SIG(me), Q_PAR(me)); /* re-arm immediately & let the destroyed Mine do the exploding */ status_ = Q_TRAN(&Missile_armed); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Missile::SM::exploding} ..........................................*/ static QState Missile_exploding(Missile * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Missile::SM::exploding} */ case Q_ENTRY_SIG: { me->exp_ctr = 0; status_ = Q_HANDLED(); break; } /*.${AOs::Missile::SM::exploding::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Missile::SM::exploding::TIME_TICK::[(me->x>=GAME_SPEED_X)&&(me->exp~} */ if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15)) { ++me->exp_ctr; /* advance the explosion counter */ me->x -= me->speed; /* move the explosion by one step */ /* tell the Tunnel to render the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | (me->x + 3) | ((int)me->y - 4) << 8); status_ = Q_HANDLED(); } /*.${AOs::Missile::SM::exploding::TIME_TICK::[else]} */ else { /* explosion finished or moved outside the game */ status_ = Q_TRAN(&Missile_armed); } break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Missile} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/armclang/game-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 game-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 game-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 0 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\game.h game.h 0 0 1 4 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 1 5 1 0 0 0 ..\..\mine1.c mine1.c 0 0 1 6 1 0 0 0 ..\..\mine2.c mine2.c 0 0 1 7 1 0 0 0 ..\..\missile.c missile.c 0 0 1 8 1 0 0 0 ..\..\ship.c ship.c 0 0 1 9 1 0 0 0 ..\..\tunnel.c tunnel.c 0 0 efm32pg1b 1 0 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 13 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 14 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 15 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 16 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 17 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c display_ls013b7dh03.c 0 0 2 18 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c displaypalemlib.c 0 0 2 19 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_prs.c 0 0 2 20 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c em_usart.c 0 0 2 21 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c udelay.c 0 0 2 22 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 23 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 24 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 25 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 26 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 27 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/armclang/game-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
game-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ game-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\game-qk.bin .\dbg\game-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c game.h 5 ..\..\game.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c mine1.c 1 ..\..\mine1.c mine2.c 1 ..\..\mine2.c missile.c 1 ..\..\missile.c ship.c 1 ..\..\ship.c tunnel.c 1 ..\..\tunnel.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c display_ls013b7dh03.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c displaypalemlib.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c em_prs.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_usart.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c udelay.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c game-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ game-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\game-qk.bin .\rel\game-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 game-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c game.h 5 ..\..\game.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c mine1.c 1 ..\..\mine1.c mine2.c 1 ..\..\mine2.c missile.c 1 ..\..\missile.c ship.c 1 ..\..\ship.c tunnel.c 1 ..\..\tunnel.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c display_ls013b7dh03.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c displaypalemlib.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c em_prs.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_usart.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c udelay.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/bsp.c ================================================ /***************************************************************************** * Product: "Fly 'n' Shoot" game example, EFM32-SLSTK3401A board, QK kernel * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "game.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_chip.h" /* Chip errata (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ #include "em_usart.h" /* USART (SiLabs) */ #include "display_ls013b7dh03.h" /* LS013b7DH03 display (SiLabs/QL) */ /* add other drivers if necessary... */ Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIO_EVEN_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIO_EVEN_IRQHandler(void); void USART0_RX_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 /* LCD geometry and frame buffer */ static uint32_t l_fb[BSP_SCREEN_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; /* the walls buffer */ static uint32_t l_walls[GAME_TUNNEL_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; static unsigned l_rnd; /* random seed */ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); /* ISRs used in the application ==========================================*/ void SysTick_Handler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* post TIME_TICK events to all interested active objects... */ QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TIME_TICK_SIG, 0); QACTIVE_POST_ISR((QActive *)&AO_Ship, TIME_TICK_SIG, 0); QACTIVE_POST_ISR((QActive *)&AO_Missile, TIME_TICK_SIG, 0); { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & (1U << PB0_PIN)) != 0U) { /* debounced PB0 state changed? */ if ((buttons.depressed & (1U << PB0_PIN)) != 0U) {/*PB0 depressed?*/ QACTIVE_POST_ISR((QActive *)&AO_Ship, PLAYER_TRIGGER_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Tunnel, PLAYER_TRIGGER_SIG, 0U); } } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /*..........................................................................*/ void GPIO_EVEN_IRQHandler(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TAKE_OFF_SIG, 0U); QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* Chip errata */ CHIP_Init(); /* NOTE: SystemInit() already called from startup_TM4C123GH6PM.s * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... */ #if 1 /* OPTION 1: * Use the automatic FPU state preservation and the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in more than one task or * in any ISRs. This setting is the safest and recommended, but requires * extra stack space and CPU cycles. */ FPU->FPCCR |= (1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos); #else /* OPTION 2: * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used in ONE task only and not * in any ISR. This setting is very efficient, but if more than one task * (or ISR) start using the FPU, this can lead to corruption of the * FPU registers. This option should be used with CAUTION. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); #endif /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); /* Initialize the DISPLAY driver. */ if (!Display_init()) { Q_ERROR(); } } /*..........................................................................*/ void BSP_updateScreen(void) { GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); Display_sendPA(&l_fb[0][0], 0, LS013B7DH03_HEIGHT); GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); } /*..........................................................................*/ void BSP_clearFB() { uint_fast8_t y; for (y = 0U; y < BSP_SCREEN_HEIGHT; ++y) { l_fb[y][0] = 0U; l_fb[y][1] = 0U; l_fb[y][2] = 0U; l_fb[y][3] = 0U; } } /*..........................................................................*/ void BSP_clearWalls() { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { l_walls[y][0] = 0U; l_walls[y][1] = 0U; l_walls[y][2] = 0U; l_walls[y][3] = 0U; } } /*..........................................................................*/ bool BSP_isThrottle(void) { /* is the throttle button depressed? */ return (GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) == 0U; } /*..........................................................................*/ void BSP_paintString(uint8_t x, uint8_t y, char const *str) { static uint8_t const font5x7[95][7] = { { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }, /* */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x00U, 0x00U, 0x04U }, /* ! */ { 0x0AU, 0x0AU, 0x0AU, 0x00U, 0x00U, 0x00U, 0x00U }, /* " */ { 0x0AU, 0x0AU, 0x1FU, 0x0AU, 0x1FU, 0x0AU, 0x0AU }, /* # */ { 0x04U, 0x1EU, 0x05U, 0x0EU, 0x14U, 0x0FU, 0x04U }, /* $ */ { 0x03U, 0x13U, 0x08U, 0x04U, 0x02U, 0x19U, 0x18U }, /* % */ { 0x06U, 0x09U, 0x05U, 0x02U, 0x15U, 0x09U, 0x16U }, /* & */ { 0x06U, 0x04U, 0x02U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ' */ { 0x08U, 0x04U, 0x02U, 0x02U, 0x02U, 0x04U, 0x08U }, /* ( */ { 0x02U, 0x04U, 0x08U, 0x08U, 0x08U, 0x04U, 0x02U }, /* ) */ { 0x00U, 0x04U, 0x15U, 0x0EU, 0x15U, 0x04U, 0x00U }, /* * */ { 0x00U, 0x04U, 0x04U, 0x1FU, 0x04U, 0x04U, 0x00U }, /* + */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x04U, 0x02U }, /* , */ { 0x00U, 0x00U, 0x00U, 0x1FU, 0x00U, 0x00U, 0x00U }, /* - */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x06U }, /* . */ { 0x00U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x00U }, /* / */ { 0x0EU, 0x11U, 0x19U, 0x15U, 0x13U, 0x11U, 0x0EU }, /* 0 */ { 0x04U, 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* 1 */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x02U, 0x1FU }, /* 2 */ { 0x1FU, 0x08U, 0x04U, 0x08U, 0x10U, 0x11U, 0x0EU }, /* 3 */ { 0x08U, 0x0CU, 0x0AU, 0x09U, 0x1FU, 0x08U, 0x08U }, /* 4 */ { 0x1FU, 0x01U, 0x0FU, 0x10U, 0x10U, 0x11U, 0x0EU }, /* 5 */ { 0x0CU, 0x02U, 0x01U, 0x0FU, 0x11U, 0x11U, 0x0EU }, /* 6 */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x02U, 0x02U }, /* 7 */ { 0x0EU, 0x11U, 0x11U, 0x0EU, 0x11U, 0x11U, 0x0EU }, /* 8 */ { 0x0EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x08U, 0x06U }, /* 9 */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x06U, 0x00U }, /* : */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x04U, 0x02U }, /* ; */ { 0x08U, 0x04U, 0x02U, 0x01U, 0x02U, 0x04U, 0x08U }, /* < */ { 0x00U, 0x00U, 0x1FU, 0x00U, 0x1FU, 0x00U, 0x00U }, /* = */ { 0x02U, 0x04U, 0x08U, 0x10U, 0x08U, 0x04U, 0x02U }, /* > */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x00U, 0x04U }, /* ? */ { 0x0EU, 0x11U, 0x10U, 0x16U, 0x15U, 0x15U, 0x0EU }, /* @ */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U }, /* A */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x11U, 0x11U, 0x0FU }, /* B */ { 0x0EU, 0x11U, 0x01U, 0x01U, 0x01U, 0x11U, 0x0EU }, /* C */ { 0x07U, 0x09U, 0x11U, 0x11U, 0x11U, 0x09U, 0x07U }, /* D */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x1FU }, /* E */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* F */ { 0x0EU, 0x11U, 0x01U, 0x1DU, 0x11U, 0x11U, 0x1EU }, /* G */ { 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U, 0x11U }, /* H */ { 0x0EU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* I */ { 0x1CU, 0x08U, 0x08U, 0x08U, 0x08U, 0x09U, 0x06U }, /* J */ { 0x11U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U, 0x11U }, /* K */ { 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x1FU }, /* L */ { 0x11U, 0x1BU, 0x15U, 0x15U, 0x11U, 0x11U, 0x11U }, /* M */ { 0x11U, 0x11U, 0x13U, 0x15U, 0x19U, 0x11U, 0x11U }, /* N */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* O */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* P */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x15U, 0x09U, 0x16U }, /* Q */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x05U, 0x09U, 0x11U }, /* R */ { 0x1EU, 0x01U, 0x01U, 0x0EU, 0x10U, 0x10U, 0x0FU }, /* S */ { 0x1FU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* T */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* U */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* V */ { 0x11U, 0x11U, 0x11U, 0x15U, 0x15U, 0x15U, 0x0AU }, /* W */ { 0x11U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U, 0x11U }, /* X */ { 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U, 0x04U, 0x04U }, /* Y */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x1FU }, /* Z */ { 0x0EU, 0x02U, 0x02U, 0x02U, 0x02U, 0x02U, 0x0EU }, /* [ */ { 0x00U, 0x01U, 0x02U, 0x04U, 0x08U, 0x10U, 0x00U }, /* \ */ { 0x0EU, 0x08U, 0x08U, 0x08U, 0x08U, 0x08U, 0x0EU }, /* ] */ { 0x04U, 0x0AU, 0x11U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ^ */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x1FU }, /* _ */ { 0x02U, 0x04U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ` */ { 0x00U, 0x00U, 0x0EU, 0x10U, 0x1EU, 0x11U, 0x1EU }, /* a */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x0FU }, /* b */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x01U, 0x11U, 0x0EU }, /* c */ { 0x10U, 0x10U, 0x16U, 0x19U, 0x11U, 0x11U, 0x1EU }, /* d */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x1FU, 0x01U, 0x0EU }, /* e */ { 0x0CU, 0x12U, 0x02U, 0x07U, 0x02U, 0x02U, 0x02U }, /* f */ { 0x00U, 0x1EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* g */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* h */ { 0x04U, 0x00U, 0x06U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* i */ { 0x08U, 0x00U, 0x0CU, 0x08U, 0x08U, 0x09U, 0x06U }, /* j */ { 0x01U, 0x01U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U }, /* k */ { 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* l */ { 0x00U, 0x00U, 0x0BU, 0x15U, 0x15U, 0x11U, 0x11U }, /* m */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* n */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x11U, 0x11U, 0x0EU }, /* o */ { 0x00U, 0x00U, 0x0FU, 0x11U, 0x0FU, 0x01U, 0x01U }, /* p */ { 0x00U, 0x00U, 0x16U, 0x19U, 0x1EU, 0x10U, 0x10U }, /* q */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x01U, 0x01U, 0x01U }, /* r */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x0EU, 0x10U, 0x0FU }, /* s */ { 0x02U, 0x02U, 0x07U, 0x02U, 0x02U, 0x12U, 0x0CU }, /* t */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x19U, 0x16U }, /* u */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* v */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x15U, 0x15U, 0x0AU }, /* w */ { 0x00U, 0x00U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }, /* x */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* y */ { 0x00U, 0x00U, 0x1FU, 0x08U, 0x04U, 0x02U, 0x1FU }, /* z */ { 0x08U, 0x04U, 0x04U, 0x02U, 0x04U, 0x04U, 0x08U }, /* { */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* | */ { 0x02U, 0x04U, 0x04U, 0x08U, 0x04U, 0x04U, 0x02U }, /* } */ { 0x02U, 0x15U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ~ */ }; for (; *str != '\0'; ++str, x += 6) { uint8_t const *ch = &font5x7[*str - ' '][0]; paintBitsClear(x, y, ch, 7); } } /*==========================================================================*/ typedef struct { /* the auxiliary structure to hold const bitmaps */ uint8_t const *bits; /* the bits in the bitmap */ uint8_t height; /* the height of the bitmap */ } Bitmap; /* bitmap of the Ship: * * x.... * xxx.. * xxxxx */ static uint8_t const ship_bits[] = { 0x01U, 0x07U, 0x1FU }; /* bitmap of the Missile: * * xxxx */ static uint8_t const missile_bits[] = { 0x0FU }; /* bitmap of the Mine type-1: * * .x. * xxx * .x. */ static uint8_t const mine1_bits[] = { 0x02U, 0x07U, 0x02U }; /* bitmap of the Mine type-2: * * x..x * .xx. * .xx. * x..x */ static uint8_t const mine2_bits[] = { 0x09U, 0x06U, 0x06U, 0x09U }; /* Mine type-2 is nastier than Mine type-1. The type-2 mine can * hit the Ship with any of its "tentacles". However, it can be * destroyed by the Missile only by hitting its center, defined as * the following bitmap: * * .... * .xx. * .xx. */ static uint8_t const mine2_missile_bits[] = { 0x00U, 0x06U, 0x06U }; /* * The bitmap of the explosion stage 0: * * ....... * ...x... * ..x.x.. * ...x... */ static uint8_t const explosion0_bits[] = { 0x00U, 0x08U, 0x14U, 0x08U }; /* * The bitmap of the explosion stage 1: * * ....... * ..x.x.. * ...x... * ..x.x.. */ static uint8_t const explosion1_bits[] = { 0x00U, 0x14U, 0x08U, 0x14U }; /* * The bitmap of the explosion stage 2: * * .x...x. * ..x.x.. * ...x... * ..x.x.. * .x...x. */ static uint8_t const explosion2_bits[] = { 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }; /* * The bitmap of the explosion stage 3: * * x..x..x * .x.x.x. * ..x.x.. * xx.x.xx * ..x.x.. * .x.x.x. * x..x..x */ static uint8_t const explosion3_bits[] = { 0x49, 0x2A, 0x14, 0x6B, 0x14, 0x2A, 0x49 }; static Bitmap const l_bitmap[MAX_BMP] = { { ship_bits, Q_DIM(ship_bits) }, { missile_bits, Q_DIM(missile_bits) }, { mine1_bits, Q_DIM(mine1_bits) }, { mine2_bits, Q_DIM(mine2_bits) }, { mine2_missile_bits, Q_DIM(mine2_missile_bits) }, { explosion0_bits, Q_DIM(explosion0_bits) }, { explosion1_bits, Q_DIM(explosion1_bits) }, { explosion2_bits, Q_DIM(explosion2_bits) }, { explosion3_bits, Q_DIM(explosion3_bits) } }; /*..........................................................................*/ void BSP_paintBitmap(uint8_t x, uint8_t y, uint8_t bmp_id) { Bitmap const *bmp = &l_bitmap[bmp_id]; paintBits(x, y, bmp->bits, bmp->height); } /*..........................................................................*/ void BSP_advanceWalls(uint8_t top, uint8_t bottom) { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { /* shift the walls one pixel to the left */ l_walls[y][0] = (l_walls[y][0] >> 1) | (l_walls[y][1] << 31); l_walls[y][1] = (l_walls[y][1] >> 1) | (l_walls[y][2] << 31); l_walls[y][2] = (l_walls[y][2] >> 1) | (l_walls[y][3] << 31); l_walls[y][3] = (l_walls[y][3] >> 1); /* add new column of walls at the end */ if (y <= top) { l_walls[y][3] |= (1U << 31); } if (y >= (GAME_TUNNEL_HEIGHT - bottom)) { l_walls[y][3] |= (1U << 31); } /* copy the walls to the frame buffer */ l_fb[y][0] = l_walls[y][0]; l_fb[y][1] = l_walls[y][1]; l_fb[y][2] = l_walls[y][2]; l_fb[y][3] = l_walls[y][3]; } } /*..........................................................................*/ bool BSP_doBitmapsOverlap(uint8_t bmp_id1, uint8_t x1, uint8_t y1, uint8_t bmp_id2, uint8_t x2, uint8_t y2) { uint8_t y; uint8_t y0; uint8_t h; uint32_t bits1; uint32_t bits2; Bitmap const *bmp1; Bitmap const *bmp2; Q_REQUIRE((bmp_id1 < Q_DIM(l_bitmap)) && (bmp_id2 < Q_DIM(l_bitmap))); /* are the bitmaps close enough in x? */ if (x1 >= x2) { if (x1 > x2 + 8U) { return false; } x1 -= x2; x2 = 0U; } else { if (x2 > x1 + 8U) { return false; } x2 -= x1; x1 = 0U; } bmp1 = &l_bitmap[bmp_id1]; bmp2 = &l_bitmap[bmp_id2]; if ((y1 <= y2) && (y1 + bmp1->height > y2)) { y0 = y2 - y1; h = y1 + bmp1->height - y2; if (h > bmp2->height) { h = bmp2->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y + y0] << x1); bits2 = ((uint32_t)bmp2->bits[y] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } else { if ((y1 > y2) && (y2 + bmp2->height > y1)) { y0 = y1 - y2; h = y2 + bmp2->height - y1; if (h > bmp1->height) { h = bmp1->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y] << x1); bits2 = ((uint32_t)bmp2->bits[y + y0] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } } return false; /* the bitmaps do not overlap */ } /*..........................................................................*/ bool BSP_isWallHit(uint8_t bmp_id, uint8_t x, uint8_t y) { Bitmap const *bmp = &l_bitmap[bmp_id]; uint32_t shft = (x & 0x1FU); uint32_t *walls = &l_walls[y][x >> 5]; for (y = 0; y < bmp->height; ++y, walls += (BSP_SCREEN_WIDTH >> 5)) { if (*walls & ((uint32_t)bmp->bits[y] << shft)) { return true; } if (shft > 24U) { if (*(walls + 1) & ((uint32_t)bmp->bits[y] >> (32U - shft))) { return true; } } } return false; } /*..........................................................................*/ void BSP_updateScore(uint16_t score) { char str[5]; uint16_t s = score; if (score == 0U) { BSP_paintString(1U, BSP_SCREEN_HEIGHT - 8U, "SCORE:"); } /* update the SCORE area on the screeen */ str[4] = '\0'; str[3] = (s % 10U) + '0'; s /= 10U; str[2] = (s % 10U) + '0'; s /= 10U; str[1] = (s % 10U) + '0'; s /= 10U; str[0] = (s % 10U) + '0'; BSP_paintString(6U*6U, BSP_SCREEN_HEIGHT - 8U, str); } /*..........................................................................*/ void BSP_displayOn(void) { Display_enable(true); } /*..........................................................................*/ void BSP_displayOff(void) { Display_enable(false); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*--------------------------------------------------------------------------*/ /*..........................................................................*/ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb |= ((uint32_t)bits[y] << shft); if (shft > 24U) { *(fb + 1) |= ((uint32_t)bits[y] >> (32U - shft)); } } } /*..........................................................................*/ static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); uint32_t mask1 = ~((uint32_t)0xFFU << shft); uint32_t mask2; if (shft > 24U) { mask2 = ~(0xFFU >> (32U - shft)); } for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb = ((*fb & mask1) | ((uint32_t)bits[y] << shft)); if (shft > 24U) { *(fb + 1) = ((*(fb + 1) & mask2) | ((uint32_t)bits[y] >> (32U - shft))); } } } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIO_EVEN_IRQn, GPIO_EVEN_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIO_EVEN_IRQn); } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QK_ISR_ENTRY/QK_ISR_ENTRY * macros or any other QF/QK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF/QK services. In particular they * can NOT call the macros QK_ISR_ENTRY/QK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QK-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := game-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ mine1.c \ mine2.c \ missile.c \ ship.c \ tunnel.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c \ em_int.c \ em_prs.c \ em_rtcc.c \ em_system.c \ em_usart.c \ udelay.c \ display_ls013b7dh03.c \ displaypalemlib.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/gnu/game-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/iar/game-qk.ewd ================================================ 2 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 ANGEL_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IARROM_ID 2 1 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 MACRAIGOR_ID 2 3 1 1 PEMICRO_ID 2 3 1 1 RDI_ID 2 2 1 1 STLINK_ID 2 3 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 5 1 1 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 ANGEL_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IARROM_ID 2 1 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 MACRAIGOR_ID 2 3 1 0 PEMICRO_ID 2 3 1 0 RDI_ID 2 2 1 0 STLINK_ID 2 3 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 5 1 0 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/iar/game-qk.ewp ================================================ 2 Debug ARM 1 General 3 24 1 1 ICCARM 2 31 1 1 AARM 2 9 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 17 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 24 1 0 ICCARM 2 31 1 0 AARM 2 9 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 17 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\game.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\mine1.c $PROJ_DIR$\..\..\mine2.c $PROJ_DIR$\..\..\missile.c $PROJ_DIR$\..\..\qpn_conf.h $PROJ_DIR$\..\..\..\..\..\include\qstamp.c $PROJ_DIR$\..\..\ship.c $PROJ_DIR$\..\..\tunnel.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_int.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\udelay.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/iar/game-qk.eww ================================================ $WS_DIR$\game-qk.ewp ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qk/iar/game-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the "Fly 'n' Shoot" game * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 2 #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\arm\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/armclang/game-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 game-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 DLGUARM / 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL040000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 game-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 3 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 3 Segger\JL2CM3.dll 0 JL2CM3 -U440060969 -O207 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC8000 -FN1 -FF0GECKOP2.FLM -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 0 DLGUARM / 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC8000 -FD20000000 -FF0GECKOP2 -FL020000 -FS00 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 5 0 0 0 ..\..\game.h game.h 0 0 1 4 1 0 0 0 ..\..\..\..\..\include\qstamp.c qstamp.c 0 0 1 5 1 0 0 0 ..\..\mine1.c mine1.c 0 0 1 6 1 0 0 0 ..\..\mine2.c mine2.c 0 0 1 7 1 0 0 0 ..\..\missile.c missile.c 0 0 1 8 1 0 0 0 ..\..\ship.c ship.c 0 0 1 9 1 0 0 0 ..\..\tunnel.c tunnel.c 0 0 efm32pg1b 1 0 0 0 2 10 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_cmu.c 0 0 2 11 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_emu.c 0 0 2 12 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_gpio.c 0 0 2 13 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_int.c 0 0 2 14 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_rtcc.c 0 0 2 15 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c em_system.c 0 0 2 16 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c system_efm32pg1b.c 0 0 2 17 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c display_ls013b7dh03.c 0 0 2 18 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c displaypalemlib.c 0 0 2 19 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_prs.c 0 0 2 20 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c em_usart.c 0 0 2 21 1 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c udelay.c 0 0 2 22 2 0 0 0 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s startup_efm32pg1b.s 0 0 QP 1 0 0 0 3 23 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 24 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 25 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 26 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 27 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/armclang/game-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
game-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\dbg\ game-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\dbg\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\dbg\game-qv.bin .\dbg\game-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c game.h 5 ..\..\game.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c mine1.c 1 ..\..\mine1.c mine2.c 1 ..\..\mine2.c missile.c 1 ..\..\missile.c ship.c 1 ..\..\ship.c tunnel.c 1 ..\..\tunnel.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c display_ls013b7dh03.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c displaypalemlib.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c em_prs.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_usart.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c udelay.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c game-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 EFM32PG1B200F256GM48 Silicon Labs SiliconLabs.EFM32PG1B_DFP.5.5.0 https://www.silabs.com/documents/public/cmsis-packs/ IRAM(0x20000000,0x00008000) IROM(0x00000000,0x00020000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC8000 -FN1 -FF0GECKOP2 -FS00 -FL020000 -FP0($$Device:EFM32PG1B200F256GM48$Flash\GECKOP2.FLM)) 0 $$Device:EFM32PG1B200F256GM48$Device\EFM32PG1B\Include\em_device.h $$Device:EFM32PG1B200F256GM48$SVD\EFM32PG1B\EFM32PG1B200F256GM48.svd 0 0 0 0 0 0 1 .\rel\ game-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 1 0 cmd /c "del .\rel\qstamp.o" 0 0 0 0 1 0 fromelf --bin --output .\rel\game-qv.bin .\rel\game-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4096 1 BIN\UL2CM3.DLL "" () 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x20000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x20000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 1 0 0 3 3 0 0 0 0 0 NDEBUG EFM32PG1B200F256GM48=1 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\efm32pg1b 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 game-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c game.h 5 ..\..\game.h qstamp.c 1 ..\..\..\..\..\include\qstamp.c mine1.c 1 ..\..\mine1.c mine2.c 1 ..\..\mine2.c missile.c 1 ..\..\missile.c ship.c 1 ..\..\ship.c tunnel.c 1 ..\..\tunnel.c efm32pg1b em_cmu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c em_emu.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c em_gpio.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c em_int.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_int.c em_rtcc.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c em_system.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_system.c system_efm32pg1b.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c display_ls013b7dh03.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c displaypalemlib.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c em_prs.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c em_usart.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c udelay.c 1 ..\..\..\..\..\3rd_party\efm32pg1b\udelay.c startup_efm32pg1b.s 2 ..\..\..\..\..\3rd_party\efm32pg1b\arm\startup_efm32pg1b.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/bsp.c ================================================ /***************************************************************************** * Product: "Fly 'n' Shoot" game example, EFM32-SLSTK3401A board, QV kernel * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "game.h" #include "bsp.h" #include "em_device.h" /* the device specific header (SiLabs) */ #include "em_chip.h" /* Chip errata (SiLabs) */ #include "em_cmu.h" /* Clock Management Unit (SiLabs) */ #include "em_gpio.h" /* GPIO (SiLabs) */ #include "em_usart.h" /* USART (SiLabs) */ #include "display_ls013b7dh03.h" /* LS013b7DH03 display (SiLabs/QL) */ /* add other drivers if necessary... */ Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { GPIO_EVEN_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ SYSTICK_PRIO, /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIO_EVEN_IRQHandler(void); void USART0_RX_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_PORT gpioPortF #define LED0_PIN 4 #define LED1_PIN 5 #define PB_PORT gpioPortF #define PB0_PIN 6 #define PB1_PIN 7 /* LCD geometry and frame buffer */ static uint32_t l_fb[BSP_SCREEN_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; /* the walls buffer */ static uint32_t l_walls[GAME_TUNNEL_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; static unsigned l_rnd; /* random seed */ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); /* ISRs used in the application ==========================================*/ void SysTick_Handler(void) { QF_tickXISR(0U); /* process time events for rate 0 */ /* post TIME_TICK events to all interested active objects... */ QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TIME_TICK_SIG, 0); QACTIVE_POST_ISR((QActive *)&AO_Ship, TIME_TICK_SIG, 0); QACTIVE_POST_ISR((QActive *)&AO_Missile, TIME_TICK_SIG, 0); { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIO->P[PB_PORT].DIN; /* read PB0 and BP1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & (1U << PB0_PIN)) != 0U) { /* debounced PB0 state changed? */ if ((buttons.depressed & (1U << PB0_PIN)) != 0U) {/*PB0 depressed?*/ QACTIVE_POST_ISR((QActive *)&AO_Ship, PLAYER_TRIGGER_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Tunnel, PLAYER_TRIGGER_SIG, 0U); } } } } /*..........................................................................*/ void GPIO_EVEN_IRQHandler(void) { QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TAKE_OFF_SIG, 0U); } /* BSP functions ===========================================================*/ void BSP_init(void) { /* Chip errata */ CHIP_Init(); /* NOTE: SystemInit() already called from startup_TM4C123GH6PM.s * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is NOT used in any ISR. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); CMU_ClockEnable(cmuClock_HFPER, true); CMU_ClockEnable(cmuClock_GPIO, true); /* configure the LEDs */ GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0); GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0); GPIO_PinOutClear(LED_PORT, LED0_PIN); GPIO_PinOutClear(LED_PORT, LED1_PIN); /* configure the Buttons */ GPIO_PinModeSet(PB_PORT, PB0_PIN, gpioModeInputPull, 1); GPIO_PinModeSet(PB_PORT, PB1_PIN, gpioModeInputPull, 1); /* Initialize the DISPLAY driver. */ if (!Display_init()) { Q_ERROR(); } } /*..........................................................................*/ void BSP_updateScreen(void) { GPIO->P[LED_PORT].DOUT |= (1U << LED1_PIN); Display_sendPA(&l_fb[0][0], 0, LS013B7DH03_HEIGHT); GPIO->P[LED_PORT].DOUT &= ~(1U << LED1_PIN); } /*..........................................................................*/ void BSP_clearFB() { uint_fast8_t y; for (y = 0U; y < BSP_SCREEN_HEIGHT; ++y) { l_fb[y][0] = 0U; l_fb[y][1] = 0U; l_fb[y][2] = 0U; l_fb[y][3] = 0U; } } /*..........................................................................*/ void BSP_clearWalls() { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { l_walls[y][0] = 0U; l_walls[y][1] = 0U; l_walls[y][2] = 0U; l_walls[y][3] = 0U; } } /*..........................................................................*/ bool BSP_isThrottle(void) { /* is the throttle button depressed? */ return (GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) == 0U; } /*..........................................................................*/ void BSP_paintString(uint8_t x, uint8_t y, char const *str) { static uint8_t const font5x7[95][7] = { { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }, /* */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x00U, 0x00U, 0x04U }, /* ! */ { 0x0AU, 0x0AU, 0x0AU, 0x00U, 0x00U, 0x00U, 0x00U }, /* " */ { 0x0AU, 0x0AU, 0x1FU, 0x0AU, 0x1FU, 0x0AU, 0x0AU }, /* # */ { 0x04U, 0x1EU, 0x05U, 0x0EU, 0x14U, 0x0FU, 0x04U }, /* $ */ { 0x03U, 0x13U, 0x08U, 0x04U, 0x02U, 0x19U, 0x18U }, /* % */ { 0x06U, 0x09U, 0x05U, 0x02U, 0x15U, 0x09U, 0x16U }, /* & */ { 0x06U, 0x04U, 0x02U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ' */ { 0x08U, 0x04U, 0x02U, 0x02U, 0x02U, 0x04U, 0x08U }, /* ( */ { 0x02U, 0x04U, 0x08U, 0x08U, 0x08U, 0x04U, 0x02U }, /* ) */ { 0x00U, 0x04U, 0x15U, 0x0EU, 0x15U, 0x04U, 0x00U }, /* * */ { 0x00U, 0x04U, 0x04U, 0x1FU, 0x04U, 0x04U, 0x00U }, /* + */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x04U, 0x02U }, /* , */ { 0x00U, 0x00U, 0x00U, 0x1FU, 0x00U, 0x00U, 0x00U }, /* - */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x06U }, /* . */ { 0x00U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x00U }, /* / */ { 0x0EU, 0x11U, 0x19U, 0x15U, 0x13U, 0x11U, 0x0EU }, /* 0 */ { 0x04U, 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* 1 */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x02U, 0x1FU }, /* 2 */ { 0x1FU, 0x08U, 0x04U, 0x08U, 0x10U, 0x11U, 0x0EU }, /* 3 */ { 0x08U, 0x0CU, 0x0AU, 0x09U, 0x1FU, 0x08U, 0x08U }, /* 4 */ { 0x1FU, 0x01U, 0x0FU, 0x10U, 0x10U, 0x11U, 0x0EU }, /* 5 */ { 0x0CU, 0x02U, 0x01U, 0x0FU, 0x11U, 0x11U, 0x0EU }, /* 6 */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x02U, 0x02U }, /* 7 */ { 0x0EU, 0x11U, 0x11U, 0x0EU, 0x11U, 0x11U, 0x0EU }, /* 8 */ { 0x0EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x08U, 0x06U }, /* 9 */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x06U, 0x00U }, /* : */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x04U, 0x02U }, /* ; */ { 0x08U, 0x04U, 0x02U, 0x01U, 0x02U, 0x04U, 0x08U }, /* < */ { 0x00U, 0x00U, 0x1FU, 0x00U, 0x1FU, 0x00U, 0x00U }, /* = */ { 0x02U, 0x04U, 0x08U, 0x10U, 0x08U, 0x04U, 0x02U }, /* > */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x00U, 0x04U }, /* ? */ { 0x0EU, 0x11U, 0x10U, 0x16U, 0x15U, 0x15U, 0x0EU }, /* @ */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U }, /* A */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x11U, 0x11U, 0x0FU }, /* B */ { 0x0EU, 0x11U, 0x01U, 0x01U, 0x01U, 0x11U, 0x0EU }, /* C */ { 0x07U, 0x09U, 0x11U, 0x11U, 0x11U, 0x09U, 0x07U }, /* D */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x1FU }, /* E */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* F */ { 0x0EU, 0x11U, 0x01U, 0x1DU, 0x11U, 0x11U, 0x1EU }, /* G */ { 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U, 0x11U }, /* H */ { 0x0EU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* I */ { 0x1CU, 0x08U, 0x08U, 0x08U, 0x08U, 0x09U, 0x06U }, /* J */ { 0x11U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U, 0x11U }, /* K */ { 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x1FU }, /* L */ { 0x11U, 0x1BU, 0x15U, 0x15U, 0x11U, 0x11U, 0x11U }, /* M */ { 0x11U, 0x11U, 0x13U, 0x15U, 0x19U, 0x11U, 0x11U }, /* N */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* O */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* P */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x15U, 0x09U, 0x16U }, /* Q */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x05U, 0x09U, 0x11U }, /* R */ { 0x1EU, 0x01U, 0x01U, 0x0EU, 0x10U, 0x10U, 0x0FU }, /* S */ { 0x1FU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* T */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* U */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* V */ { 0x11U, 0x11U, 0x11U, 0x15U, 0x15U, 0x15U, 0x0AU }, /* W */ { 0x11U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U, 0x11U }, /* X */ { 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U, 0x04U, 0x04U }, /* Y */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x1FU }, /* Z */ { 0x0EU, 0x02U, 0x02U, 0x02U, 0x02U, 0x02U, 0x0EU }, /* [ */ { 0x00U, 0x01U, 0x02U, 0x04U, 0x08U, 0x10U, 0x00U }, /* \ */ { 0x0EU, 0x08U, 0x08U, 0x08U, 0x08U, 0x08U, 0x0EU }, /* ] */ { 0x04U, 0x0AU, 0x11U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ^ */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x1FU }, /* _ */ { 0x02U, 0x04U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ` */ { 0x00U, 0x00U, 0x0EU, 0x10U, 0x1EU, 0x11U, 0x1EU }, /* a */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x0FU }, /* b */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x01U, 0x11U, 0x0EU }, /* c */ { 0x10U, 0x10U, 0x16U, 0x19U, 0x11U, 0x11U, 0x1EU }, /* d */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x1FU, 0x01U, 0x0EU }, /* e */ { 0x0CU, 0x12U, 0x02U, 0x07U, 0x02U, 0x02U, 0x02U }, /* f */ { 0x00U, 0x1EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* g */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* h */ { 0x04U, 0x00U, 0x06U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* i */ { 0x08U, 0x00U, 0x0CU, 0x08U, 0x08U, 0x09U, 0x06U }, /* j */ { 0x01U, 0x01U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U }, /* k */ { 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* l */ { 0x00U, 0x00U, 0x0BU, 0x15U, 0x15U, 0x11U, 0x11U }, /* m */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* n */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x11U, 0x11U, 0x0EU }, /* o */ { 0x00U, 0x00U, 0x0FU, 0x11U, 0x0FU, 0x01U, 0x01U }, /* p */ { 0x00U, 0x00U, 0x16U, 0x19U, 0x1EU, 0x10U, 0x10U }, /* q */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x01U, 0x01U, 0x01U }, /* r */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x0EU, 0x10U, 0x0FU }, /* s */ { 0x02U, 0x02U, 0x07U, 0x02U, 0x02U, 0x12U, 0x0CU }, /* t */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x19U, 0x16U }, /* u */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* v */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x15U, 0x15U, 0x0AU }, /* w */ { 0x00U, 0x00U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }, /* x */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* y */ { 0x00U, 0x00U, 0x1FU, 0x08U, 0x04U, 0x02U, 0x1FU }, /* z */ { 0x08U, 0x04U, 0x04U, 0x02U, 0x04U, 0x04U, 0x08U }, /* { */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* | */ { 0x02U, 0x04U, 0x04U, 0x08U, 0x04U, 0x04U, 0x02U }, /* } */ { 0x02U, 0x15U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ~ */ }; for (; *str != '\0'; ++str, x += 6) { uint8_t const *ch = &font5x7[*str - ' '][0]; paintBitsClear(x, y, ch, 7); } } /*==========================================================================*/ typedef struct { /* the auxiliary structure to hold const bitmaps */ uint8_t const *bits; /* the bits in the bitmap */ uint8_t height; /* the height of the bitmap */ } Bitmap; /* bitmap of the Ship: * * x.... * xxx.. * xxxxx */ static uint8_t const ship_bits[] = { 0x01U, 0x07U, 0x1FU }; /* bitmap of the Missile: * * xxxx */ static uint8_t const missile_bits[] = { 0x0FU }; /* bitmap of the Mine type-1: * * .x. * xxx * .x. */ static uint8_t const mine1_bits[] = { 0x02U, 0x07U, 0x02U }; /* bitmap of the Mine type-2: * * x..x * .xx. * .xx. * x..x */ static uint8_t const mine2_bits[] = { 0x09U, 0x06U, 0x06U, 0x09U }; /* Mine type-2 is nastier than Mine type-1. The type-2 mine can * hit the Ship with any of its "tentacles". However, it can be * destroyed by the Missile only by hitting its center, defined as * the following bitmap: * * .... * .xx. * .xx. */ static uint8_t const mine2_missile_bits[] = { 0x00U, 0x06U, 0x06U }; /* * The bitmap of the explosion stage 0: * * ....... * ...x... * ..x.x.. * ...x... */ static uint8_t const explosion0_bits[] = { 0x00U, 0x08U, 0x14U, 0x08U }; /* * The bitmap of the explosion stage 1: * * ....... * ..x.x.. * ...x... * ..x.x.. */ static uint8_t const explosion1_bits[] = { 0x00U, 0x14U, 0x08U, 0x14U }; /* * The bitmap of the explosion stage 2: * * .x...x. * ..x.x.. * ...x... * ..x.x.. * .x...x. */ static uint8_t const explosion2_bits[] = { 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }; /* * The bitmap of the explosion stage 3: * * x..x..x * .x.x.x. * ..x.x.. * xx.x.xx * ..x.x.. * .x.x.x. * x..x..x */ static uint8_t const explosion3_bits[] = { 0x49, 0x2A, 0x14, 0x6B, 0x14, 0x2A, 0x49 }; static Bitmap const l_bitmap[MAX_BMP] = { { ship_bits, Q_DIM(ship_bits) }, { missile_bits, Q_DIM(missile_bits) }, { mine1_bits, Q_DIM(mine1_bits) }, { mine2_bits, Q_DIM(mine2_bits) }, { mine2_missile_bits, Q_DIM(mine2_missile_bits) }, { explosion0_bits, Q_DIM(explosion0_bits) }, { explosion1_bits, Q_DIM(explosion1_bits) }, { explosion2_bits, Q_DIM(explosion2_bits) }, { explosion3_bits, Q_DIM(explosion3_bits) } }; /*..........................................................................*/ void BSP_paintBitmap(uint8_t x, uint8_t y, uint8_t bmp_id) { Bitmap const *bmp = &l_bitmap[bmp_id]; paintBits(x, y, bmp->bits, bmp->height); } /*..........................................................................*/ void BSP_advanceWalls(uint8_t top, uint8_t bottom) { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { /* shift the walls one pixel to the left */ l_walls[y][0] = (l_walls[y][0] >> 1) | (l_walls[y][1] << 31); l_walls[y][1] = (l_walls[y][1] >> 1) | (l_walls[y][2] << 31); l_walls[y][2] = (l_walls[y][2] >> 1) | (l_walls[y][3] << 31); l_walls[y][3] = (l_walls[y][3] >> 1); /* add new column of walls at the end */ if (y <= top) { l_walls[y][3] |= (1U << 31); } if (y >= (GAME_TUNNEL_HEIGHT - bottom)) { l_walls[y][3] |= (1U << 31); } /* copy the walls to the frame buffer */ l_fb[y][0] = l_walls[y][0]; l_fb[y][1] = l_walls[y][1]; l_fb[y][2] = l_walls[y][2]; l_fb[y][3] = l_walls[y][3]; } } /*..........................................................................*/ bool BSP_doBitmapsOverlap(uint8_t bmp_id1, uint8_t x1, uint8_t y1, uint8_t bmp_id2, uint8_t x2, uint8_t y2) { uint8_t y; uint8_t y0; uint8_t h; uint32_t bits1; uint32_t bits2; Bitmap const *bmp1; Bitmap const *bmp2; Q_REQUIRE((bmp_id1 < Q_DIM(l_bitmap)) && (bmp_id2 < Q_DIM(l_bitmap))); /* are the bitmaps close enough in x? */ if (x1 >= x2) { if (x1 > x2 + 8U) { return false; } x1 -= x2; x2 = 0U; } else { if (x2 > x1 + 8U) { return false; } x2 -= x1; x1 = 0U; } bmp1 = &l_bitmap[bmp_id1]; bmp2 = &l_bitmap[bmp_id2]; if ((y1 <= y2) && (y1 + bmp1->height > y2)) { y0 = y2 - y1; h = y1 + bmp1->height - y2; if (h > bmp2->height) { h = bmp2->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y + y0] << x1); bits2 = ((uint32_t)bmp2->bits[y] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } else { if ((y1 > y2) && (y2 + bmp2->height > y1)) { y0 = y1 - y2; h = y2 + bmp2->height - y1; if (h > bmp1->height) { h = bmp1->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y] << x1); bits2 = ((uint32_t)bmp2->bits[y + y0] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } } return false; /* the bitmaps do not overlap */ } /*..........................................................................*/ bool BSP_isWallHit(uint8_t bmp_id, uint8_t x, uint8_t y) { Bitmap const *bmp = &l_bitmap[bmp_id]; uint32_t shft = (x & 0x1FU); uint32_t *walls = &l_walls[y][x >> 5]; for (y = 0; y < bmp->height; ++y, walls += (BSP_SCREEN_WIDTH >> 5)) { if (*walls & ((uint32_t)bmp->bits[y] << shft)) { return true; } if (shft > 24U) { if (*(walls + 1) & ((uint32_t)bmp->bits[y] >> (32U - shft))) { return true; } } } return false; } /*..........................................................................*/ void BSP_updateScore(uint16_t score) { char str[5]; uint16_t s = score; if (score == 0U) { BSP_paintString(1U, BSP_SCREEN_HEIGHT - 8U, "SCORE:"); } /* update the SCORE area on the screeen */ str[4] = '\0'; str[3] = (s % 10U) + '0'; s /= 10U; str[2] = (s % 10U) + '0'; s /= 10U; str[1] = (s % 10U) + '0'; s /= 10U; str[0] = (s % 10U) + '0'; BSP_paintString(6U*6U, BSP_SCREEN_HEIGHT - 8U, str); } /*..........................................................................*/ void BSP_displayOn(void) { Display_enable(true); } /*..........................................................................*/ void BSP_displayOff(void) { Display_enable(false); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*--------------------------------------------------------------------------*/ /*..........................................................................*/ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb |= ((uint32_t)bits[y] << shft); if (shft > 24U) { *(fb + 1) |= ((uint32_t)bits[y] >> (32U - shft)); } } } /*..........................................................................*/ static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); uint32_t mask1 = ~((uint32_t)0xFFU << shft); uint32_t mask2; if (shft > 24U) { mask2 = ~(0xFFU >> (32U - shft)); } for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb = ((*fb & mask1) | ((uint32_t)bits[y] << shft)); if (shft > 24U) { *(fb + 1) = ((*(fb + 1) & mask2) | ((uint32_t)bits[y] >> (32U - shft))); } } } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); NVIC_SetPriority(GPIO_EVEN_IRQn, GPIO_EVEN_PRIO); /* ... */ /* enable IRQs... */ NVIC_EnableIRQ(GPIO_EVEN_IRQn); #ifdef Q_SPY NVIC_EnableIRQ(USART0_RX_IRQn); /* UART0 interrupt used for QS-RX */ #endif } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts disabled, see NOTE01 */ /* toggle the User LED on and then off, see NOTE02 */ GPIO->P[LED_PORT].DOUT |= (1U << LED0_PIN); GPIO->P[LED_PORT].DOUT &= ~(1U << LED0_PIN); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const *module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; #ifndef NDEBUG /* light up both LEDs */ GPIO->P[LED_PORT].DOUT |= ((1U << LED0_PIN) | (1U << LED1_PIN)); /* for debugging, hang on in an endless loop until PB1 is pressed... */ while ((GPIO->P[PB_PORT].DIN & (1U << PB1_PIN)) != 0) { } #endif NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call the QK_ISR_ENTRY/QK_ISR_ENTRY * macros or any other QF/QK services. These ISRs are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF/QK services. In particular they * can NOT call the macros QK_ISR_ENTRY/QK_ISR_ENTRY. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EMF32-SLSTK3401A, QV-nano kernel, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := game-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/efm32pg1b \ $(QPN)/3rd_party/efm32pg1b/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/efm32pg1b #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ mine1.c \ mine2.c \ missile.c \ ship.c \ tunnel.c \ startup_efm32pg1b.c \ system_efm32pg1b.c \ em_cmu.c \ em_emu.c \ em_gpio.c \ em_int.c \ em_prs.c \ em_rtcc.c \ em_system.c \ em_usart.c \ udelay.c \ display_ls013b7dh03.c \ displaypalemlib.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := \ LIB_DIRS := LIBS := # defines DEFINES := -DEFM32PG1B200F256GM48=1 # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the EFM32PG1B200F256GM48 MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\gnu\startup_efm32pg1b.c The file startup_efm32pg1b.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EFM32-SLSTK3401A board :: :: NOTE: requires the J-Link commander (JLink.exe) from SEGGER, see: :: https://www.segger.com/j-link-commander.html :: setlocal @echo off @echo Load a given binary file to the flash of EFM32-SLSTK3401A @echo usage: flash bin-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: JLink utility on your machine :: if [%JLINK%] EQU [] set JLINK=%QTOOLS%\..\JLink if not exist "%JLINK%\JLink.exe" ( @echo The JLink tool not found. Please adjust flash.bat @goto end ) if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) :: generate the Jlink command file depending on the first parameter %1 @echo si 1 >flash.jlink @echo speed 4000 >>flash.jlink @echo r >>flash.jlink @echo h >>flash.jlink @echo loadbin %1, 0 >>flash.jlink @echo exit >>flash.jlink @echo on %JLINK%\JLink.exe -device EFM32PG1B200F256GM48 flash.jlink @echo off @del flash.jlink :end endlocal ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/gnu/game-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EFM32-SLSTK3401A, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://state-machine.com * mailto:info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Pearl Gecko EFM32PG1B200F256GM48 */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script blinky-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\efm32pg1b\iar\startup_efm32pg1b.s The file startup_efm32pg1b.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/iar/game-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/iar/game-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 cmd /c "if exist $OBJ_DIR$\qstamp.o del $OBJ_DIR$\qstamp.o" ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\game.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\mine1.c $PROJ_DIR$\..\..\mine2.c $PROJ_DIR$\..\..\missile.c $PROJ_DIR$\..\..\qpn_conf.h $PROJ_DIR$\..\..\..\..\..\include\qstamp.c $PROJ_DIR$\..\..\ship.c $PROJ_DIR$\..\..\tunnel.c efm32pg1b $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\display_ls013b7dh03.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\displaypalemlib.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_assert.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_cmu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_emu.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_gpio.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_int.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_prs.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_rtcc.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_system.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\em_usart.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\iar\startup_efm32pg1b.s $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\system_efm32pg1b.c $PROJ_DIR$\..\..\..\..\..\3rd_party\efm32pg1b\udelay.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/iar/game-qv.eww ================================================ $WS_DIR$\game-qv.ewp ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/qv/iar/game-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/ship.c ================================================ /*.$file${.::ship.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::ship.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::ship.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "game.h" #include "bsp.h" /* Q_DEFINE_THIS_MODULE(ship) */ #define SHIP_WIDTH 5U #define SHIP_HEIGHT 3U /* encapsulated delcaration of the Ship active object ----------------------*/ /*.$declare${AOs::Ship} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Ship} ............................................................*/ typedef struct Ship { /* protected: */ QActive super; /* private: */ uint8_t x; uint16_t y; uint8_t exp_ctr; uint16_t score; } Ship; /* protected: */ static QState Ship_initial(Ship * const me); static QState Ship_active(Ship * const me); static QState Ship_parked(Ship * const me); static QState Ship_flying(Ship * const me); static QState Ship_exploding(Ship * const me); /*.$enddecl${AOs::Ship} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* global objects ----------------------------------------------------------*/ Ship AO_Ship; /* Active object definition ------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Ship_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Ship_ctor} .......................................................*/ void Ship_ctor(void) { Ship *me = &AO_Ship; QActive_ctor(&me->super, Q_STATE_CAST(&Ship_initial)); me->x = GAME_SHIP_X; me->y = (GAME_SHIP_Y << 2); } /*.$enddef${AOs::Ship_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Ship} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Ship} ............................................................*/ /*.${AOs::Ship::SM} ........................................................*/ static QState Ship_initial(Ship * const me) { /*.${AOs::Ship::SM::initial} */ return Q_TRAN(&Ship_active); } /*.${AOs::Ship::SM::active} ................................................*/ static QState Ship_active(Ship * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Ship::SM::active::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Ship_parked); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Ship::SM::active::parked} ........................................*/ static QState Ship_parked(Ship * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Ship::SM::active::parked::TAKE_OFF} */ case TAKE_OFF_SIG: { status_ = Q_TRAN(&Ship_flying); break; } default: { status_ = Q_SUPER(&Ship_active); break; } } return status_; } /*.${AOs::Ship::SM::active::flying} ........................................*/ static QState Ship_flying(Ship * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Ship::SM::active::flying} */ case Q_ENTRY_SIG: { me->score = 0; /* reset the score */ QACTIVE_POST(&AO_Tunnel, SCORE_SIG, me->score); /* lauch the ship from the initial position */ me->x = GAME_SHIP_X; me->y = (GAME_SHIP_Y << 2); status_ = Q_HANDLED(); break; } /*.${AOs::Ship::SM::active::flying::TIME_TICK} */ case TIME_TICK_SIG: { /* move the Ship up or down depending on the button state */ if (BSP_isThrottle()) { if (me->y > 0) { me->y -= 1U; } } else { if (me->y < (GAME_TUNNEL_HEIGHT << 2)) { me->y += 1U; } } /* tell the Tunnel to draw the Ship and test for hits */ QACTIVE_POST(&AO_Tunnel, SHIP_IMG_SIG, (SHIP_BMP << 16) | me->x | ((me->y >> 2) << 8)); ++me->score; /* increment the score for surviving another tick */ if ((me->score % 10) == 0) { /* is the score "round"? */ QACTIVE_POST(&AO_Tunnel, SCORE_SIG, me->score); } status_ = Q_HANDLED(); break; } /*.${AOs::Ship::SM::active::flying::PLAYER_TRIGGER} */ case PLAYER_TRIGGER_SIG: { QACTIVE_POST(&AO_Missile, MISSILE_FIRE_SIG, me->x | (((me->y >> 2) - 1 + SHIP_HEIGHT) & 0xFFU) << 8); status_ = Q_HANDLED(); break; } /*.${AOs::Ship::SM::active::flying::DESTROYED_MINE} */ case DESTROYED_MINE_SIG: { me->score += (uint16_t)Q_PAR(me); /* the score will be sent to the Tunnel by the next TIME_TICK */ status_ = Q_HANDLED(); break; } /*.${AOs::Ship::SM::active::flying::HIT_WALL} */ case HIT_WALL_SIG: { status_ = Q_TRAN(&Ship_exploding); break; } /*.${AOs::Ship::SM::active::flying::HIT_MINE} */ case HIT_MINE_SIG: { status_ = Q_TRAN(&Ship_exploding); break; } default: { status_ = Q_SUPER(&Ship_active); break; } } return status_; } /*.${AOs::Ship::SM::active::exploding} .....................................*/ static QState Ship_exploding(Ship * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Ship::SM::active::exploding} */ case Q_ENTRY_SIG: { me->exp_ctr = 0; status_ = Q_HANDLED(); break; } /*.${AOs::Ship::SM::active::exploding::TIME_TICK} */ case TIME_TICK_SIG: { /*.${AOs::Ship::SM::active::exploding::TIME_TICK::[me->exp_ctr<15]} */ if (me->exp_ctr < 15) { ++me->exp_ctr; /* tell the Tunnel to draw the current stage of Explosion */ QACTIVE_POST(&AO_Tunnel, EXPLOSION_SIG, ((EXPLOSION0_BMP + (me->exp_ctr >> 2)) << 16) | me->x | ((((me->y >> 2) - 4U + SHIP_HEIGHT) & 0xFFU) << 8)); status_ = Q_HANDLED(); } /*.${AOs::Ship::SM::active::exploding::TIME_TICK::[else]} */ else { QACTIVE_POST(&AO_Tunnel, GAME_OVER_SIG, me->score); status_ = Q_TRAN(&Ship_parked); } break; } default: { status_ = Q_SUPER(&Ship_active); break; } } return status_; } /*.$enddef${AOs::Ship} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/tunnel.c ================================================ /*.$file${.::tunnel.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: game.qm * File: ${.::tunnel.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::tunnel.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "game.h" #include "bsp.h" Q_DEFINE_THIS_MODULE("tunnel") /* local objects -----------------------------------------------------------*/ /*.$declare${AOs::Tunnel} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Tunnel} ..........................................................*/ typedef struct Tunnel { /* protected: */ QActive super; /* private: */ QHsm * mines[GAME_MINES_MAX]; QHsm * mine1_pool[GAME_MINES_MAX]; QHsm * mine2_pool[GAME_MINES_MAX]; uint8_t blink_ctr; uint8_t last_mine_x; uint8_t last_mine_y; uint8_t wall_thickness_top; uint8_t wall_thickness_bottom; uint8_t wall_gap; } Tunnel; /* private: */ static void Tunnel_advance(Tunnel * const me); static void Tunnel_plantMine(Tunnel * const me); static void Tunnel_dispatchToAllMines(Tunnel * const me, QSignal sig, QParam par); /* protected: */ static QState Tunnel_initial(Tunnel * const me); static QState Tunnel_active(Tunnel * const me); static QState Tunnel_show_logo(Tunnel * const me); static QState Tunnel_demo(Tunnel * const me); static QState Tunnel_playing(Tunnel * const me); static QState Tunnel_game_over(Tunnel * const me); static QState Tunnel_screen_saver(Tunnel * const me); static QState Tunnel_screen_saver_hide(Tunnel * const me); static QState Tunnel_screen_saver_show(Tunnel * const me); static QState Tunnel_final(Tunnel * const me); /*.$enddecl${AOs::Tunnel} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* global objects ----------------------------------------------------------*/ Tunnel AO_Tunnel; /* Active object definition ================================================*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Tunnel_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Tunnel_ctor} .....................................................*/ void Tunnel_ctor(void) { uint8_t n; Tunnel *me = &AO_Tunnel; QActive_ctor(&me->super, Q_STATE_CAST(&Tunnel_initial)); for (n = 0; n < GAME_MINES_MAX; ++n) { me->mine1_pool[n] = Mine1_ctor(n); /* instantiate Mine1 in the pool */ me->mine2_pool[n] = Mine2_ctor(n); /* instantiate Mine2 in the pool */ me->mines[n] = (QHsm *)0; /* mine 'n' is unused */ } me->last_mine_x = 0; /* the last mine at the right edge of the tunnel */ me->last_mine_y = 0; } /*.$enddef${AOs::Tunnel_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Tunnel} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Tunnel} ..........................................................*/ /*.${AOs::Tunnel::advance} .................................................*/ static void Tunnel_advance(Tunnel * const me) { uint32_t rnd; rnd = (BSP_random() & 0xFFU); /* reduce the top wall thickness 18.75% of the time */ if ((rnd < 48U) && (me->wall_thickness_top > 0U)) { --me->wall_thickness_top; } /* reduce the bottom wall thickness 18.75% of the time */ if ((rnd > 208U) && (me->wall_thickness_bottom > 0U)) { --me->wall_thickness_bottom; } rnd = (BSP_random() & 0xFFU); /* grow the bottom wall thickness 19.14% of the time */ if ((rnd < 49U) && ((GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom) > me->wall_gap)) { ++me->wall_thickness_bottom; } /* grow the top wall thickness 19.14% of the time */ if ((rnd > 207U) && ((GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom) > me->wall_gap)) { ++me->wall_thickness_top; } /* advance the Tunnel by 1 game step to the left * and copy the Tunnel layer to the main frame buffer */ BSP_advanceWalls(me->wall_thickness_top, me->wall_thickness_bottom); } /*.${AOs::Tunnel::plantMine} ...............................................*/ static void Tunnel_plantMine(Tunnel * const me) { uint32_t rnd = (BSP_random() & 0xFFU); if (me->last_mine_x > 0U) { --me->last_mine_x; /* shift the last Mine 1 position to the left */ } /* last mine far enough? */ if ((me->last_mine_x + GAME_MINES_DIST_MIN < GAME_TUNNEL_WIDTH) && (rnd < 8U)) /* place the mines only 5% of the time */ { uint8_t n; for (n = 0U; n < Q_DIM(me->mines); ++n) { /*look for disabled mines */ if (me->mines[n] == (QHsm *)0) { break; } } if (n < Q_DIM(me->mines)) { /* a disabled Mine found? */ rnd = (BSP_random() & 0xFFFFU); if ((rnd & 1U) == 0U) { /* choose the type of the mine */ me->mines[n] = me->mine1_pool[n]; } else { me->mines[n] = me->mine2_pool[n]; } /* new Mine is planted by the end of the tunnel */ me->last_mine_x = GAME_TUNNEL_WIDTH - 8U; /* choose a random y-position for the Mine in the Tunnel */ rnd %= (GAME_TUNNEL_HEIGHT - me->wall_thickness_top - me->wall_thickness_bottom - 4U); me->last_mine_y = (uint8_t)(me->wall_thickness_top + 2U + rnd); Q_SIG(me->mines[n]) = MINE_PLANT_SIG; Q_PAR(me->mines[n]) = (me->last_mine_x | (me->last_mine_y << 8)); QHSM_DISPATCH(me->mines[n]); /* direct dispatch */ } } } /*.${AOs::Tunnel::dispatchToAllMines} ......................................*/ static void Tunnel_dispatchToAllMines(Tunnel * const me, QSignal sig, QParam par) { uint8_t n; for (n = 0; n < GAME_MINES_MAX; ++n) { if (me->mines[n] != (QHsm *)0) { /* is the mine used? */ Q_SIG(me->mines[n]) = sig; Q_PAR(me->mines[n]) = par; QHSM_DISPATCH(me->mines[n]); } } } /*.${AOs::Tunnel::SM} ......................................................*/ static QState Tunnel_initial(Tunnel * const me) { /*.${AOs::Tunnel::SM::initial} */ uint8_t n; for (n = 0; n < GAME_MINES_MAX; ++n) { QHSM_INIT(me->mine1_pool[n]); /* initial tran. for Mine1 */ QHSM_INIT(me->mine2_pool[n]); /* initial tran. for Mine2 */ } BSP_randomSeed(1234U); /* seed the pseudo-random generator */ return Q_TRAN(&Tunnel_show_logo); } /*.${AOs::Tunnel::SM::active} ..............................................*/ static QState Tunnel_active(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::MINE_DISABLED} */ case MINE_DISABLED_SIG: { Q_ASSERT((Q_PAR(me) < GAME_MINES_MAX) && (me->mines[Q_PAR(me)] != (QHsm *)0)); me->mines[Q_PAR(me)] = (QHsm *)0; status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::PLAYER_QUIT} */ case PLAYER_QUIT_SIG: { status_ = Q_TRAN(&Tunnel_final); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Tunnel::SM::active::show_logo} ...................................*/ static QState Tunnel_show_logo(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::show_logo} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 10U; BSP_paintString(24U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "Quantum LeAps"); BSP_paintString(16U, (GAME_TUNNEL_HEIGHT / 2U) + 0U, "state-machine.com"); BSP_paintString(1U, GAME_TUNNEL_HEIGHT - 18U, "Fire missile: BTN0"); BSP_paintString(1U, GAME_TUNNEL_HEIGHT - 10U, "Fly ship up: BTN1"); BSP_updateScreen(); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::show_logo} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::show_logo::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { --me->blink_ctr; /* toggle the blink couner */ /*.${AOs::Tunnel::SM::active::show_logo::Q_TIMEOUT::[me->blink_ctr==0U]} */ if (me->blink_ctr == 0U) { status_ = Q_TRAN(&Tunnel_demo); } /*.${AOs::Tunnel::SM::active::show_logo::Q_TIMEOUT::[else]} */ else { /*.${AOs::Tunnel::SM::active::show_logo::Q_TIMEOUT::[else]::[(me->blink_ctr&1U)!=0U]} */ if ((me->blink_ctr & 1U) != 0U) { BSP_paintString(24U + 8U*6U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "LeAps"); BSP_updateScreen(); status_ = Q_HANDLED(); } /*.${AOs::Tunnel::SM::active::show_logo::Q_TIMEOUT::[else]::[else]} */ else { BSP_paintString(24U + 8U*6U, (GAME_TUNNEL_HEIGHT / 2U) - 8U, "LeaPs"); BSP_updateScreen(); status_ = Q_HANDLED(); } } break; } default: { status_ = Q_SUPER(&Tunnel_active); break; } } return status_; } /*.${AOs::Tunnel::SM::active::demo} ........................................*/ static QState Tunnel_demo(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::demo} */ case Q_ENTRY_SIG: { me->last_mine_x = 0U; /* last mine at right edge of the tunnel */ me->last_mine_y = 0U; /* set the tunnel properties... */ me->wall_thickness_top = 0U; me->wall_thickness_bottom = 0U; me->wall_gap = GAME_WALLS_GAP_Y; /* clear the tunnel walls */ BSP_clearWalls(); QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 20U*2U; /* 20s timeout total */ status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::demo} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::demo::TIME_TICK} */ case TIME_TICK_SIG: { Tunnel_advance(me); if (me->blink_ctr != 0U) { /* add the text bitmap into the frame buffer */ BSP_paintString((GAME_TUNNEL_WIDTH - 10U*6U)/2U, (GAME_TUNNEL_HEIGHT - 4U)/2U, "Press BTN0"); } BSP_updateScreen(); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::demo::PLAYER_TRIGGER} */ case PLAYER_TRIGGER_SIG: { status_ = Q_TRAN(&Tunnel_playing); break; } /*.${AOs::Tunnel::SM::active::demo::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { --me->blink_ctr; /*.${AOs::Tunnel::SM::active::demo::Q_TIMEOUT::[me->blink_ctr==0]} */ if (me->blink_ctr == 0) { status_ = Q_TRAN(&Tunnel_screen_saver); } else { status_ = Q_UNHANDLED(); } break; } default: { status_ = Q_SUPER(&Tunnel_active); break; } } return status_; } /*.${AOs::Tunnel::SM::active::playing} .....................................*/ static QState Tunnel_playing(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::playing} */ case Q_ENTRY_SIG: { me->wall_gap = GAME_WALLS_GAP_Y; QACTIVE_POST(&AO_Ship, TAKE_OFF_SIG, 0); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing} */ case Q_EXIT_SIG: { Tunnel_dispatchToAllMines(me, MINE_RECYCLE_SIG, 0); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::TIME_TICK} */ case TIME_TICK_SIG: { /* render this frame on the display */ BSP_updateScreen(); Tunnel_advance(me); Tunnel_plantMine(me); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::SHIP_IMG} */ case SHIP_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /* did the Ship/Missile hit the tunnel wall? */ if (BSP_isWallHit(bmp, x, y)) { QACTIVE_POST(&AO_Ship, HIT_WALL_SIG, 0); } BSP_paintBitmap(x, y, bmp); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::MISSILE_IMG} */ case MISSILE_IMG_SIG: { uint8_t x = (uint8_t)Q_PAR(me); uint8_t y = (uint8_t)(Q_PAR(me) >> 8); uint8_t bmp = (uint8_t)(Q_PAR(me) >> 16); /* did the Ship/Missile hit the tunnel wall? */ if (BSP_isWallHit(bmp, x, y)) { QACTIVE_POST(&AO_Missile, HIT_WALL_SIG, 0); } BSP_paintBitmap(x, y, bmp); Tunnel_dispatchToAllMines(me, Q_SIG(me), Q_PAR(me)); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::MINE_IMG} */ case MINE_IMG_SIG: { BSP_paintBitmap((uint8_t)Q_PAR(me), (uint8_t)(Q_PAR(me) >> 8), (uint8_t)(Q_PAR(me) >> 16)); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::EXPLOSION} */ case EXPLOSION_SIG: { BSP_paintBitmap((uint8_t)Q_PAR(me), (uint8_t)(Q_PAR(me) >> 8), (uint8_t)(Q_PAR(me) >> 16)); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::SCORE} */ case SCORE_SIG: { BSP_updateScore((uint16_t)Q_PAR(me)); /* increase difficulty of the game: * the tunnel gets narrower as the score goes up */ me->wall_gap = (uint8_t)(GAME_WALLS_GAP_Y - (uint16_t)Q_PAR(me)/100U); if (me->wall_gap < GAME_WALLS_MIN_GAP_Y) { me->wall_gap = GAME_WALLS_MIN_GAP_Y; } status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::playing::GAME_OVER} */ case GAME_OVER_SIG: { BSP_clearWalls(); BSP_updateScore((uint16_t)Q_PAR(me)); BSP_updateScreen(); status_ = Q_TRAN(&Tunnel_game_over); break; } default: { status_ = Q_SUPER(&Tunnel_active); break; } } return status_; } /*.${AOs::Tunnel::SM::active::game_over} ...................................*/ static QState Tunnel_game_over(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::game_over} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); /* periodic */ me->blink_ctr = 5U*2U; /* 5s timeout */ BSP_paintString((GAME_TUNNEL_WIDTH - 6U * 9U) / 2U, (GAME_TUNNEL_HEIGHT / 2U) - 4U, "Game Over"); BSP_updateScreen(); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::game_over} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); BSP_updateScore(0); /* update the score on the display */ status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::game_over::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { --me->blink_ctr; BSP_paintString((GAME_TUNNEL_WIDTH - 6U*9U) / 2U, (GAME_TUNNEL_HEIGHT / 2U) - 4U, (((me->blink_ctr & 1) != 0) ? "Game Over" : " ")); BSP_updateScreen(); /*.${AOs::Tunnel::SM::active::game_over::Q_TIMEOUT::[me->blink_ctr==0]} */ if (me->blink_ctr == 0) { status_ = Q_TRAN(&Tunnel_demo); } else { status_ = Q_UNHANDLED(); } break; } default: { status_ = Q_SUPER(&Tunnel_active); break; } } return status_; } /*.${AOs::Tunnel::SM::active::screen_saver} ................................*/ static QState Tunnel_screen_saver(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::screen_saver::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Tunnel_screen_saver_hide); break; } /*.${AOs::Tunnel::SM::active::screen_saver::PLAYER_TRIGGER} */ case PLAYER_TRIGGER_SIG: { status_ = Q_TRAN(&Tunnel_demo); break; } default: { status_ = Q_SUPER(&Tunnel_active); break; } } return status_; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_hide} .............*/ static QState Tunnel_screen_saver_hide(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_hide} */ case Q_ENTRY_SIG: { BSP_displayOff(); /* power down the display */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC*3U, 0U); /* 3 sec */ status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_hide} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); BSP_displayOn(); /* power up the display */ status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_hid~::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Tunnel_screen_saver_show); break; } default: { status_ = Q_SUPER(&Tunnel_screen_saver); break; } } return status_; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_show} .............*/ static QState Tunnel_screen_saver_show(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_show} */ case Q_ENTRY_SIG: { uint32_t rnd = BSP_random(); /* clear the screen frame buffer */ BSP_clearFB(); BSP_paintString((uint8_t)(rnd % (GAME_TUNNEL_WIDTH - 10U*6U)), (uint8_t) (rnd % (GAME_TUNNEL_HEIGHT - 8U)), "Press BTN0"); BSP_updateScreen(); QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/3U, 0U);/* 1/3 sec */ status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_show} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); BSP_clearFB(); BSP_updateScreen(); status_ = Q_HANDLED(); break; } /*.${AOs::Tunnel::SM::active::screen_saver::screen_saver_sho~::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Tunnel_screen_saver_hide); break; } default: { status_ = Q_SUPER(&Tunnel_screen_saver); break; } } return status_; } /*.${AOs::Tunnel::SM::final} ...............................................*/ static QState Tunnel_final(Tunnel * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Tunnel::SM::final} */ case Q_ENTRY_SIG: { /* clear the screen */ BSP_clearFB(); BSP_updateScreen(); QF_stop(); /* stop QF and cleanup */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Tunnel} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/win32-gui/bsp.c ================================================ /***************************************************************************** * Product: "Fly 'n' Shoot" game example, EFM32-SLSTK3401A, Win32-GUI * Last Updated for Version: 6.7.0 * Date of the Last Update: 2020-01-06 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "game.h" #include "bsp.h" #include "qwin_gui.h" /* QWIN GUI */ #include "resource.h" /* GUI resource IDs generated by the resource editior */ #include "safe_std.h" /* portable "safe" / facilities */ Q_DEFINE_THIS_FILE /* local variables ---------------------------------------------------------*/ static HINSTANCE l_hInst; /* this application instance */ static HWND l_hWnd; /* main window handle */ static LPSTR l_cmdLine; /* the command line string */ static GraphicDisplay l_lcd; /* LCD display on EFM32-SLSTK3401A */ static SegmentDisplay l_userLED0; /* USER LED0 on EFM32-SLSTK3401A */ static SegmentDisplay l_userLED1; /* USER LED1 on EFM32-SLSTK3401A */ static SegmentDisplay l_scoreBoard; /* segment display for the score */ static OwnerDrawnButton l_userBtn0; /* USER Button0 on EFM32-SLSTK3401A */ static OwnerDrawnButton l_userBtn1; /* USER Button1 on EFM32-SLSTK3401A */ /* (R,G,B) colors for the LCD display */ static BYTE const c_onColor[3] = { 0x07U, 0x07U, 0x07U }; /* dark grey */ static BYTE const c_offColor[3] = { 0xA0U, 0xA0U, 0xA0U }; /* light grey */ /* LCD geometry and frame buffer */ static uint32_t l_fb[BSP_SCREEN_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; /* the walls buffer */ static uint32_t l_walls[GAME_TUNNEL_HEIGHT + 1][BSP_SCREEN_WIDTH / 32U]; static unsigned l_rnd; /* random seed */ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h); /* Local functions ---------------------------------------------------------*/ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam); /*..........................................................................*/ static void playerTrigger(void) { QACTIVE_POST((QActive *)&AO_Ship, PLAYER_TRIGGER_SIG, 0U); QACTIVE_POST((QActive *)&AO_Tunnel, PLAYER_TRIGGER_SIG, 0U); } /*..........................................................................*/ void BSP_init(void) { } /*..........................................................................*/ void BSP_terminate(int16_t result) { QF_stop(); /* stop the main QF application and the ticker thread */ /* cleanup all QWIN resources... */ OwnerDrawnButton_xtor(&l_userBtn0); /* cleanup the l_userBtn0 resources */ OwnerDrawnButton_xtor(&l_userBtn1); /* cleanup the l_userBtn1 resources */ SegmentDisplay_xtor(&l_userLED0); /* cleanup the l_userLED0 resources */ SegmentDisplay_xtor(&l_userLED1); /* cleanup the l_userLED1 resources */ SegmentDisplay_xtor(&l_scoreBoard); /* cleanup the scoreBoard resources */ GraphicDisplay_xtor(&l_lcd); /* cleanup the l_lcd resources */ /* end the main dialog */ EndDialog(l_hWnd, result); } /*..........................................................................*/ void BSP_updateScreen(void) { UINT x, y; /* turn LED1 on */ SegmentDisplay_setSegment(&l_userLED1, 0U, 1U); /* map the LCD pixels to the GraphicDisplay pixels... */ for (y = 0; y < BSP_SCREEN_HEIGHT; ++y) { for (x = 0; x < BSP_SCREEN_WIDTH; ++x) { uint32_t bits = l_fb[y][x >> 5]; if ((bits & (1U << (x & 0x1FU))) != 0U) { GraphicDisplay_setPixel(&l_lcd, x, y, c_onColor); } else { GraphicDisplay_clearPixel(&l_lcd, x, y); } } } GraphicDisplay_redraw(&l_lcd); /* redraw the updated display */ /* turn LED1 off */ SegmentDisplay_setSegment(&l_userLED1, 0U, 0U); } /*..........................................................................*/ void BSP_clearFB() { uint_fast8_t y; for (y = 0U; y < BSP_SCREEN_HEIGHT; ++y) { l_fb[y][0] = 0U; l_fb[y][1] = 0U; l_fb[y][2] = 0U; l_fb[y][3] = 0U; } } /*..........................................................................*/ void BSP_clearWalls() { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { l_walls[y][0] = 0U; l_walls[y][1] = 0U; l_walls[y][2] = 0U; l_walls[y][3] = 0U; } } /*..........................................................................*/ bool BSP_isThrottle(void) { /* is the throttle button depressed? */ return OwnerDrawnButton_isDepressed(&l_userBtn1) != 0; } /*..........................................................................*/ void BSP_paintString(uint8_t x, uint8_t y, char const *str) { static uint8_t const font5x7[95][7] = { { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }, /* */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x00U, 0x00U, 0x04U }, /* ! */ { 0x0AU, 0x0AU, 0x0AU, 0x00U, 0x00U, 0x00U, 0x00U }, /* " */ { 0x0AU, 0x0AU, 0x1FU, 0x0AU, 0x1FU, 0x0AU, 0x0AU }, /* # */ { 0x04U, 0x1EU, 0x05U, 0x0EU, 0x14U, 0x0FU, 0x04U }, /* $ */ { 0x03U, 0x13U, 0x08U, 0x04U, 0x02U, 0x19U, 0x18U }, /* % */ { 0x06U, 0x09U, 0x05U, 0x02U, 0x15U, 0x09U, 0x16U }, /* & */ { 0x06U, 0x04U, 0x02U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ' */ { 0x08U, 0x04U, 0x02U, 0x02U, 0x02U, 0x04U, 0x08U }, /* ( */ { 0x02U, 0x04U, 0x08U, 0x08U, 0x08U, 0x04U, 0x02U }, /* ) */ { 0x00U, 0x04U, 0x15U, 0x0EU, 0x15U, 0x04U, 0x00U }, /* * */ { 0x00U, 0x04U, 0x04U, 0x1FU, 0x04U, 0x04U, 0x00U }, /* + */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x04U, 0x02U }, /* , */ { 0x00U, 0x00U, 0x00U, 0x1FU, 0x00U, 0x00U, 0x00U }, /* - */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x06U, 0x06U }, /* . */ { 0x00U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x00U }, /* / */ { 0x0EU, 0x11U, 0x19U, 0x15U, 0x13U, 0x11U, 0x0EU }, /* 0 */ { 0x04U, 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* 1 */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x02U, 0x1FU }, /* 2 */ { 0x1FU, 0x08U, 0x04U, 0x08U, 0x10U, 0x11U, 0x0EU }, /* 3 */ { 0x08U, 0x0CU, 0x0AU, 0x09U, 0x1FU, 0x08U, 0x08U }, /* 4 */ { 0x1FU, 0x01U, 0x0FU, 0x10U, 0x10U, 0x11U, 0x0EU }, /* 5 */ { 0x0CU, 0x02U, 0x01U, 0x0FU, 0x11U, 0x11U, 0x0EU }, /* 6 */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x02U, 0x02U }, /* 7 */ { 0x0EU, 0x11U, 0x11U, 0x0EU, 0x11U, 0x11U, 0x0EU }, /* 8 */ { 0x0EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x08U, 0x06U }, /* 9 */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x06U, 0x00U }, /* : */ { 0x00U, 0x06U, 0x06U, 0x00U, 0x06U, 0x04U, 0x02U }, /* ; */ { 0x08U, 0x04U, 0x02U, 0x01U, 0x02U, 0x04U, 0x08U }, /* < */ { 0x00U, 0x00U, 0x1FU, 0x00U, 0x1FU, 0x00U, 0x00U }, /* = */ { 0x02U, 0x04U, 0x08U, 0x10U, 0x08U, 0x04U, 0x02U }, /* > */ { 0x0EU, 0x11U, 0x10U, 0x08U, 0x04U, 0x00U, 0x04U }, /* ? */ { 0x0EU, 0x11U, 0x10U, 0x16U, 0x15U, 0x15U, 0x0EU }, /* @ */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U }, /* A */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x11U, 0x11U, 0x0FU }, /* B */ { 0x0EU, 0x11U, 0x01U, 0x01U, 0x01U, 0x11U, 0x0EU }, /* C */ { 0x07U, 0x09U, 0x11U, 0x11U, 0x11U, 0x09U, 0x07U }, /* D */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x1FU }, /* E */ { 0x1FU, 0x01U, 0x01U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* F */ { 0x0EU, 0x11U, 0x01U, 0x1DU, 0x11U, 0x11U, 0x1EU }, /* G */ { 0x11U, 0x11U, 0x11U, 0x1FU, 0x11U, 0x11U, 0x11U }, /* H */ { 0x0EU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* I */ { 0x1CU, 0x08U, 0x08U, 0x08U, 0x08U, 0x09U, 0x06U }, /* J */ { 0x11U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U, 0x11U }, /* K */ { 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x01U, 0x1FU }, /* L */ { 0x11U, 0x1BU, 0x15U, 0x15U, 0x11U, 0x11U, 0x11U }, /* M */ { 0x11U, 0x11U, 0x13U, 0x15U, 0x19U, 0x11U, 0x11U }, /* N */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* O */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x01U, 0x01U, 0x01U }, /* P */ { 0x0EU, 0x11U, 0x11U, 0x11U, 0x15U, 0x09U, 0x16U }, /* Q */ { 0x0FU, 0x11U, 0x11U, 0x0FU, 0x05U, 0x09U, 0x11U }, /* R */ { 0x1EU, 0x01U, 0x01U, 0x0EU, 0x10U, 0x10U, 0x0FU }, /* S */ { 0x1FU, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* T */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0EU }, /* U */ { 0x11U, 0x11U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* V */ { 0x11U, 0x11U, 0x11U, 0x15U, 0x15U, 0x15U, 0x0AU }, /* W */ { 0x11U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U, 0x11U }, /* X */ { 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U, 0x04U, 0x04U }, /* Y */ { 0x1FU, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U, 0x1FU }, /* Z */ { 0x0EU, 0x02U, 0x02U, 0x02U, 0x02U, 0x02U, 0x0EU }, /* [ */ { 0x00U, 0x01U, 0x02U, 0x04U, 0x08U, 0x10U, 0x00U }, /* \ */ { 0x0EU, 0x08U, 0x08U, 0x08U, 0x08U, 0x08U, 0x0EU }, /* ] */ { 0x04U, 0x0AU, 0x11U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ^ */ { 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x1FU }, /* _ */ { 0x02U, 0x04U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ` */ { 0x00U, 0x00U, 0x0EU, 0x10U, 0x1EU, 0x11U, 0x1EU }, /* a */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x0FU }, /* b */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x01U, 0x11U, 0x0EU }, /* c */ { 0x10U, 0x10U, 0x16U, 0x19U, 0x11U, 0x11U, 0x1EU }, /* d */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x1FU, 0x01U, 0x0EU }, /* e */ { 0x0CU, 0x12U, 0x02U, 0x07U, 0x02U, 0x02U, 0x02U }, /* f */ { 0x00U, 0x1EU, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* g */ { 0x01U, 0x01U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* h */ { 0x04U, 0x00U, 0x06U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* i */ { 0x08U, 0x00U, 0x0CU, 0x08U, 0x08U, 0x09U, 0x06U }, /* j */ { 0x01U, 0x01U, 0x09U, 0x05U, 0x03U, 0x05U, 0x09U }, /* k */ { 0x06U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x0EU }, /* l */ { 0x00U, 0x00U, 0x0BU, 0x15U, 0x15U, 0x11U, 0x11U }, /* m */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x11U, 0x11U, 0x11U }, /* n */ { 0x00U, 0x00U, 0x0EU, 0x11U, 0x11U, 0x11U, 0x0EU }, /* o */ { 0x00U, 0x00U, 0x0FU, 0x11U, 0x0FU, 0x01U, 0x01U }, /* p */ { 0x00U, 0x00U, 0x16U, 0x19U, 0x1EU, 0x10U, 0x10U }, /* q */ { 0x00U, 0x00U, 0x0DU, 0x13U, 0x01U, 0x01U, 0x01U }, /* r */ { 0x00U, 0x00U, 0x0EU, 0x01U, 0x0EU, 0x10U, 0x0FU }, /* s */ { 0x02U, 0x02U, 0x07U, 0x02U, 0x02U, 0x12U, 0x0CU }, /* t */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x19U, 0x16U }, /* u */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x11U, 0x0AU, 0x04U }, /* v */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x15U, 0x15U, 0x0AU }, /* w */ { 0x00U, 0x00U, 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }, /* x */ { 0x00U, 0x00U, 0x11U, 0x11U, 0x1EU, 0x10U, 0x0EU }, /* y */ { 0x00U, 0x00U, 0x1FU, 0x08U, 0x04U, 0x02U, 0x1FU }, /* z */ { 0x08U, 0x04U, 0x04U, 0x02U, 0x04U, 0x04U, 0x08U }, /* { */ { 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U, 0x04U }, /* | */ { 0x02U, 0x04U, 0x04U, 0x08U, 0x04U, 0x04U, 0x02U }, /* } */ { 0x02U, 0x15U, 0x08U, 0x00U, 0x00U, 0x00U, 0x00U }, /* ~ */ }; for (; *str != '\0'; ++str, x += 6) { uint8_t const *ch = &font5x7[*str - ' '][0]; paintBitsClear(x, y, ch, 7); } } /*==========================================================================*/ typedef struct { /* the auxiliary structure to hold const bitmaps */ uint8_t const *bits; /* the bits in the bitmap */ uint8_t height; /* the height of the bitmap */ } Bitmap; /* bitmap of the Ship: * * x.... * xxx.. * xxxxx */ static uint8_t const ship_bits[] = { 0x01U, 0x07U, 0x1FU }; /* bitmap of the Missile: * * xxxx */ static uint8_t const missile_bits[] = { 0x0FU }; /* bitmap of the Mine type-1: * * .x. * xxx * .x. */ static uint8_t const mine1_bits[] = { 0x02U, 0x07U, 0x02U }; /* bitmap of the Mine type-2: * * x..x * .xx. * .xx. * x..x */ static uint8_t const mine2_bits[] = { 0x09U, 0x06U, 0x06U, 0x09U }; /* Mine type-2 is nastier than Mine type-1. The type-2 mine can * hit the Ship with any of its "tentacles". However, it can be * destroyed by the Missile only by hitting its center, defined as * the following bitmap: * * .... * .xx. * .xx. */ static uint8_t const mine2_missile_bits[] = { 0x00U, 0x06U, 0x06U }; /* * The bitmap of the explosion stage 0: * * ....... * ...x... * ..x.x.. * ...x... */ static uint8_t const explosion0_bits[] = { 0x00U, 0x08U, 0x14U, 0x08U }; /* * The bitmap of the explosion stage 1: * * ....... * ..x.x.. * ...x... * ..x.x.. */ static uint8_t const explosion1_bits[] = { 0x00U, 0x14U, 0x08U, 0x14U }; /* * The bitmap of the explosion stage 2: * * .x...x. * ..x.x.. * ...x... * ..x.x.. * .x...x. */ static uint8_t const explosion2_bits[] = { 0x11U, 0x0AU, 0x04U, 0x0AU, 0x11U }; /* * The bitmap of the explosion stage 3: * * x..x..x * .x.x.x. * ..x.x.. * xx.x.xx * ..x.x.. * .x.x.x. * x..x..x */ static uint8_t const explosion3_bits[] = { 0x49, 0x2A, 0x14, 0x6B, 0x14, 0x2A, 0x49 }; static Bitmap const l_bitmap[MAX_BMP] = { { ship_bits, Q_DIM(ship_bits) }, { missile_bits, Q_DIM(missile_bits) }, { mine1_bits, Q_DIM(mine1_bits) }, { mine2_bits, Q_DIM(mine2_bits) }, { mine2_missile_bits, Q_DIM(mine2_missile_bits) }, { explosion0_bits, Q_DIM(explosion0_bits) }, { explosion1_bits, Q_DIM(explosion1_bits) }, { explosion2_bits, Q_DIM(explosion2_bits) }, { explosion3_bits, Q_DIM(explosion3_bits) } }; /*..........................................................................*/ void BSP_paintBitmap(uint8_t x, uint8_t y, uint8_t bmp_id) { Bitmap const *bmp = &l_bitmap[bmp_id]; paintBits(x, y, bmp->bits, bmp->height); } /*..........................................................................*/ void BSP_advanceWalls(uint8_t top, uint8_t bottom) { uint_fast8_t y; for (y = 0U; y < GAME_TUNNEL_HEIGHT; ++y) { /* shift the walls one pixel to the left */ l_walls[y][0] = (l_walls[y][0] >> 1) | (l_walls[y][1] << 31); l_walls[y][1] = (l_walls[y][1] >> 1) | (l_walls[y][2] << 31); l_walls[y][2] = (l_walls[y][2] >> 1) | (l_walls[y][3] << 31); l_walls[y][3] = (l_walls[y][3] >> 1); /* add new column of walls at the end */ if (y <= top) { l_walls[y][3] |= (1U << 31); } if (y >= (GAME_TUNNEL_HEIGHT - bottom)) { l_walls[y][3] |= (1U << 31); } /* copy the walls to the frame buffer */ l_fb[y][0] = l_walls[y][0]; l_fb[y][1] = l_walls[y][1]; l_fb[y][2] = l_walls[y][2]; l_fb[y][3] = l_walls[y][3]; } } /*..........................................................................*/ bool BSP_doBitmapsOverlap(uint8_t bmp_id1, uint8_t x1, uint8_t y1, uint8_t bmp_id2, uint8_t x2, uint8_t y2) { uint8_t y; uint8_t y0; uint8_t h; uint32_t bits1; uint32_t bits2; Bitmap const *bmp1; Bitmap const *bmp2; Q_REQUIRE((bmp_id1 < Q_DIM(l_bitmap)) && (bmp_id2 < Q_DIM(l_bitmap))); /* are the bitmaps close enough in x? */ if (x1 >= x2) { if (x1 > x2 + 8U) { return false; } x1 -= x2; x2 = 0U; } else { if (x2 > x1 + 8U) { return false; } x2 -= x1; x1 = 0U; } bmp1 = &l_bitmap[bmp_id1]; bmp2 = &l_bitmap[bmp_id2]; if ((y1 <= y2) && (y1 + bmp1->height > y2)) { y0 = y2 - y1; h = y1 + bmp1->height - y2; if (h > bmp2->height) { h = bmp2->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y + y0] << x1); bits2 = ((uint32_t)bmp2->bits[y] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } else { if ((y1 > y2) && (y2 + bmp2->height > y1)) { y0 = y1 - y2; h = y2 + bmp2->height - y1; if (h > bmp1->height) { h = bmp1->height; } for (y = 0; y < h; ++y) { /* scan over the overlapping rows */ bits1 = ((uint32_t)bmp1->bits[y] << x1); bits2 = ((uint32_t)bmp2->bits[y + y0] << x2); if ((bits1 & bits2) != 0U) { /* do the bits overlap? */ return true; /* yes! */ } } } } return false; /* the bitmaps do not overlap */ } /*..........................................................................*/ bool BSP_isWallHit(uint8_t bmp_id, uint8_t x, uint8_t y) { Bitmap const *bmp = &l_bitmap[bmp_id]; uint32_t shft = (x & 0x1FU); uint32_t *walls = &l_walls[y][x >> 5]; for (y = 0; y < bmp->height; ++y, walls += (BSP_SCREEN_WIDTH >> 5)) { if (*walls & ((uint32_t)bmp->bits[y] << shft)) { return true; } if (shft > 24U) { if (*(walls + 1) & ((uint32_t)bmp->bits[y] >> (32U - shft))) { return true; } } } return false; } /*..........................................................................*/ void BSP_updateScore(uint16_t score) { uint8_t seg[5]; char str[5]; if (score == 0U) { BSP_paintString(1U, BSP_SCREEN_HEIGHT - 8U, "SCORE:"); } seg[0] = score % 10U; score /= 10U; seg[1] = score % 10U; score /= 10U; seg[2] = score % 10U; score /= 10U; seg[3] = score % 10U; /* update the SCORE area on the screeen */ str[0] = seg[3] + '0'; str[1] = seg[2] + '0'; str[2] = seg[1] + '0'; str[3] = seg[0] + '0'; str[4] = '\0'; BSP_paintString(6U*6U, BSP_SCREEN_HEIGHT - 8U, str); /* update the score in the l_scoreBoard SegmentDisplay */ SegmentDisplay_setSegment(&l_scoreBoard, 0U, (UINT)seg[0]); SegmentDisplay_setSegment(&l_scoreBoard, 1U, (UINT)seg[1]); SegmentDisplay_setSegment(&l_scoreBoard, 2U, (UINT)seg[2]); SegmentDisplay_setSegment(&l_scoreBoard, 3U, (UINT)seg[3]); } /*..........................................................................*/ void BSP_displayOn(void) { SegmentDisplay_setSegment(&l_userLED0, 0U, 1U); } /*..........................................................................*/ void BSP_displayOff(void) { SegmentDisplay_setSegment(&l_userLED0, 0U, 0U); GraphicDisplay_clear(&l_lcd); GraphicDisplay_redraw(&l_lcd); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_setTickRate(BSP_TICKS_PER_SEC, 30U); /* set the desired tick rate */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ /* post TIME_TICK events to all interested active objects... */ QACTIVE_POST_ISR((QActive *)&AO_Tunnel, TIME_TICK_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Ship, TIME_TICK_SIG, 0U); QACTIVE_POST_ISR((QActive *)&AO_Missile, TIME_TICK_SIG, 0U); } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const * const module, int_t loc) { char message[80]; QF_stop(); /* stop ticking */ SNPRINTF_S(message, Q_DIM(message) - 1, "Assertion failed in module %s location %d", module, loc); MessageBox(l_hWnd, message, "!!! ASSERTION !!!", MB_OK | MB_ICONEXCLAMATION | MB_APPLMODAL); PostQuitMessage(-1); } /*--------------------------------------------------------------------------*/ /*..........................................................................*/ static void paintBits(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb |= ((uint32_t)bits[y] << shft); if (shft > 24U) { *(fb + 1) |= ((uint32_t)bits[y] >> (32U - shft)); } } } /*..........................................................................*/ static void paintBitsClear(uint8_t x, uint8_t y, uint8_t const *bits, uint8_t h) { uint32_t *fb = &l_fb[y][x >> 5]; uint32_t shft = (x & 0x1FU); uint32_t mask1 = ~((uint32_t)0xFFU << shft); uint32_t mask2; if (shft > 24U) { mask2 = ~(0xFFU >> (32U - shft)); } for (y = 0; y < h; ++y, fb += (BSP_SCREEN_WIDTH >> 5)) { *fb = ((*fb & mask1) | ((uint32_t)bits[y] << shft)); if (shft > 24U) { *(fb + 1) = ((*(fb + 1) & mask2) | ((uint32_t)bits[y] >> (32U - shft))); } } } /*..........................................................................*/ /* thread function for running the application main_gui() */ static DWORD WINAPI appThread(LPVOID par) { (void)par; /* unused parameter */ return (DWORD)main_gui(); /* run the QF application */ } /*--------------------------------------------------------------------------*/ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int iCmdShow) { HWND hWnd; MSG msg; (void)hPrevInst; /* unused parameter */ l_hInst = hInst; /* save the application instance */ l_cmdLine = cmdLine; /* save the command line string */ //AllocConsole(); /* create the main custom dialog window */ hWnd = CreateCustDialog(hInst, IDD_APPLICATION, NULL, &WndProc, "MY_CLASS"); ShowWindow(hWnd, iCmdShow); /* show the main window */ /* enter the message loop... */ while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } //FreeConsole(); BSP_terminate(0); return msg.wParam; } /*..........................................................................*/ static LRESULT CALLBACK WndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { switch (iMsg) { /* Perform initialization upon cration of the main dialog window * NOTE: Any child-windows are NOT created yet at this time, so * the GetDlgItem() function can't be used (it will return NULL). */ case WM_CREATE: { l_hWnd = hWnd; /* save the window handle */ /* initialize the owner-drawn buttons... * NOTE: must be done *before* the first drawing of the buttons, * so WM_INITDIALOG is too late. */ OwnerDrawnButton_init(&l_userBtn0, IDC_USER0, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_UP)), LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_DWN)), LoadCursor(NULL, IDC_HAND)); OwnerDrawnButton_init(&l_userBtn1, IDC_USER1, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_UP)), LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_BTN_DWN)), LoadCursor(NULL, IDC_HAND)); return 0; } /* Perform initialization after all child windows have been created */ case WM_INITDIALOG: { GraphicDisplay_init(&l_lcd, 128, 128, IDC_LCD, c_offColor); SegmentDisplay_init(&l_userLED0, 1U, /* 1 "segment" (the LED0 itself) */ 2U); /* 2 bitmaps (for LED0 OFF/ON states) */ SegmentDisplay_initSegment(&l_userLED0, 0U, IDC_LED0); SegmentDisplay_initBitmap(&l_userLED0, 0U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_OFF))); SegmentDisplay_initBitmap(&l_userLED0, 1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_ON))); SegmentDisplay_init(&l_userLED1, 1U, /* 1 "segment" (the LED1 itself) */ 2U); /* 2 bitmaps (for LED1 OFF/ON states) */ SegmentDisplay_initSegment(&l_userLED1, 0U, IDC_LED1); SegmentDisplay_initBitmap(&l_userLED1, 0U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_OFF))); SegmentDisplay_initBitmap(&l_userLED1, 1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_LED_ON))); SegmentDisplay_init(&l_scoreBoard, 4U, /* 4 "segments" (digits 0-3) */ 10U); /* 10 bitmaps (for 0-9 states) */ SegmentDisplay_initSegment(&l_scoreBoard, 0U, IDC_SEG0); SegmentDisplay_initSegment(&l_scoreBoard, 1U, IDC_SEG1); SegmentDisplay_initSegment(&l_scoreBoard, 2U, IDC_SEG2); SegmentDisplay_initSegment(&l_scoreBoard, 3U, IDC_SEG3); SegmentDisplay_initBitmap(&l_scoreBoard, 0U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG0))); SegmentDisplay_initBitmap(&l_scoreBoard, 1U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG1))); SegmentDisplay_initBitmap(&l_scoreBoard, 2U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG2))); SegmentDisplay_initBitmap(&l_scoreBoard, 3U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG3))); SegmentDisplay_initBitmap(&l_scoreBoard, 4U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG4))); SegmentDisplay_initBitmap(&l_scoreBoard, 5U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG5))); SegmentDisplay_initBitmap(&l_scoreBoard, 6U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG6))); SegmentDisplay_initBitmap(&l_scoreBoard, 7U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG7))); SegmentDisplay_initBitmap(&l_scoreBoard, 8U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG8))); SegmentDisplay_initBitmap(&l_scoreBoard, 9U, LoadBitmap(l_hInst, MAKEINTRESOURCE(IDB_SEG9))); BSP_updateScore(0U); /* --> QP: spawn the application thread to run main_gui() */ Q_ALLEGE(CreateThread(NULL, 0, &appThread, NULL, 0, NULL) != (HANDLE)0); return 0; } case WM_DESTROY: { OutputDebugString("DESTROY\n"); PostQuitMessage(0); return 0; } /* commands from regular buttons and menus... */ case WM_COMMAND: { SetFocus(hWnd); switch (wParam) { case IDOK: case IDCANCEL: { OutputDebugString("QUIT\n"); PostQuitMessage(0); break; } } return 0; } /* owner-drawn buttons... */ case WM_DRAWITEM: { LPDRAWITEMSTRUCT pdis = (LPDRAWITEMSTRUCT)lParam; switch (pdis->CtlID) { case IDC_USER0: { /* USER owner-drawn Button0 */ OutputDebugString("USER0\n"); switch (OwnerDrawnButton_draw(&l_userBtn0, pdis)) { case BTN_DEPRESSED: { playerTrigger(); SegmentDisplay_setSegment(&l_userLED0, 0U, 1U); break; } case BTN_RELEASED: { SegmentDisplay_setSegment(&l_userLED0, 0U, 0U); break; } default: { break; } } break; } case IDC_USER1: { /* USER owner-drawn Button1 */ OutputDebugString("USER1\n"); switch (OwnerDrawnButton_draw(&l_userBtn1, pdis)) { default: { break; } } break; } } return 0; } /* mouse wheel input... */ case WM_MOUSEWHEEL: { OutputDebugString("MOUSEWHEEL\n"); return 0; } /* keyboard input... */ case WM_KEYDOWN: { OutputDebugString("KEYDOWN\n"); switch (wParam) { case VK_SPACE: playerTrigger(); OwnerDrawnButton_set(&l_userBtn0, 1); break; } return 0; } case WM_KEYUP: { OutputDebugString("KEYUP\n"); switch (wParam) { case VK_SPACE: OwnerDrawnButton_set(&l_userBtn0, 0); break; } return 0; } } return DefWindowProc(hWnd, iMsg, wParam, lParam); } ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/win32-gui/game-gui.sln ================================================ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "game-gui", "game-gui.vcxproj", "{79027B25-0949-4F66-9765-4EFBCBBEFB94}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Debug|Win32.ActiveCfg = Debug|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Debug|Win32.Build.0 = Debug|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Release|Win32.ActiveCfg = Release|Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/win32-gui/game-gui.vcxproj ================================================ Debug Win32 Release Win32 {79027B25-0949-4F66-9765-4EFBCBBEFB94} game-gui 10.0 Application false NotSet v142 Application false NotSet v142 <_ProjectFileVersion>10.0.40219.1 $(Configuration)\ $(Configuration)\ false false $(Configuration)\ $(Configuration)\ false false NDEBUG;%(PreprocessorDefinitions) true true Win32 .\Release/game-gui.tlb MaxSpeed OnlyExplicitInline .;..;../../../../include;../../../../ports/win32-qv QWIN_GUI;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) false MultiThreaded true $(IntDir) $(IntDir) $(IntDir) Level3 true Default NDEBUG;%(PreprocessorDefinitions) 0x0409 %(AdditionalDependencies) $(OutDir)$(ProjectName).exe true %(AdditionalLibraryDirectories) Windows false MachineX86 true .\Release/game-gui.bsc _DEBUG;%(PreprocessorDefinitions) true true Win32 .\Debug/game-gui.tlb Disabled .;..;../../../../include;../../../../ports/win32-qv QWIN_GUI;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) false Default MultiThreaded $(IntDir) $(IntDir) $(IntDir) true Level3 true ProgramDatabase Default _DEBUG;%(PreprocessorDefinitions) 0x0409 %(AdditionalDependencies) $(OutDir)$(ProjectName).exe true %(AdditionalLibraryDirectories) true false Windows false MachineX86 true .\Debug/game-gui.bsc %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/win32-gui/game-gui.vcxproj.filters ================================================  QP QP QP QP QP Res Res Res Res Res Res {382909e6-fb4e-4829-941e-d3461d9ce146} {cead428d-5be7-440c-b491-936bfc2a36a3} ================================================ FILE: examples/arm-cm/game_efm32-slstk3401a/win32-gui/resource.h ================================================ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by Resource.rc // #define IDD_APPLICATION 101 #define IDC_LCD 111 #define IDC_LED0 112 #define IDC_LED1 113 #define IDC_USER0 114 #define IDC_USER1 115 #define IDB_BACKGROUND 120 #define IDB_BTN_UP 137 #define IDB_BTN_DWN 138 #define IDB_LCD 142 #define IDB_LED_OFF 144 #define IDB_LED_ON 145 #define IDB_SEG 146 #define IDB_SEG0 150 #define IDB_SEG1 151 #define IDB_SEG2 152 #define IDB_SEG3 153 #define IDB_SEG4 154 #define IDB_SEG5 155 #define IDB_SEG6 156 #define IDB_SEG7 157 #define IDB_SEG8 158 #define IDB_SEG9 159 #define IDC_SEG0 1020 #define IDC_SEG1 1021 #define IDC_SEG2 1022 #define IDC_SEG3 1023 #define IDS_APP_TITLE 40000 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 111 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1002 #define _APS_NEXT_SYMED_VALUE 123 #endif #endif ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm_pelican_ek-tm4c123gxl.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/bsp.h ================================================ /***************************************************************************** * Product: BSP for PELICAN crossing example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U enum BSP_CarsSignal { CARS_RED, CARS_YELLOW, CARS_GREEN, CARS_BLANK }; enum BSP_PedsSignal { PEDS_DONT_WALK, PEDS_WALK, PEDS_BLANK }; void BSP_init(void); void BSP_showState(char_t const *state); void BSP_signalCars(enum BSP_CarsSignal sig); void BSP_signalPeds(enum BSP_PedsSignal sig); #endif /* BSP_H */ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/main.c ================================================ /***************************************************************************** * Product: PELICAN crossing example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*..........................................................................*/ static QEvt l_pelicanQueue[3]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Pelican, l_pelicanQueue, Q_DIM(l_pelicanQueue) } }; /*..........................................................................*/ int main (void) { Pelican_ctor(); /* instantiate the Pelican AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/pelican.c ================================================ /*.$file${.::pelican.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ /*.$declare${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ typedef struct Pelican { /* protected: */ QActive super; /* private: */ uint8_t flashCtr; } Pelican; /* protected: */ static QState Pelican_initial(Pelican * const me); static QState Pelican_operational(Pelican * const me); static QState Pelican_carsEnabled(Pelican * const me); static QState Pelican_carsGreen(Pelican * const me); static QState Pelican_carsGreenNoPed(Pelican * const me); static QState Pelican_carsGreenInt(Pelican * const me); static QState Pelican_carsGreenPedWait(Pelican * const me); static QState Pelican_carsYellow(Pelican * const me); static QState Pelican_pedsEnabled(Pelican * const me); static QState Pelican_pedsWalk(Pelican * const me); static QState Pelican_pedsFlash(Pelican * const me); static QState Pelican_offline(Pelican * const me); /*.$enddecl${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void) { QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); } /*.$enddef${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ /*.${components::Pelican::SM} ..............................................*/ static QState Pelican_initial(Pelican * const me) { /*.${components::Pelican::SM::initial} */ return Q_TRAN(&Pelican_operational); } /*.${components::Pelican::SM::operational} .................................*/ static QState Pelican_operational(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsEnabled); break; } /*.${components::Pelican::SM::operational::OFF} */ case OFF_SIG: { status_ = Q_TRAN(&Pelican_offline); break; } /*.${components::Pelican::SM::operational::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled} ....................*/ static QState Pelican_carsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled} */ case Q_EXIT_SIG: { BSP_signalCars(CARS_RED); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreen); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} .........*/ static QState Pelican_carsGreen(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenNoPed); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ static QState Pelican_carsGreenNoPed(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenNoPed"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsGreenPedWait); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenInt); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ static QState Pelican_carsGreenInt(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenInt"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ static QState Pelican_carsGreenPedWait(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenPedWait"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} ........*/ static QState Pelican_carsYellow(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_ENTRY_SIG: { BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsEnabled); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled} ....................*/ static QState Pelican_pedsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled} */ case Q_EXIT_SIG: { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_pedsWalk); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} ..........*/ static QState Pelican_pedsWalk(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_ENTRY_SIG: { BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsFlash); break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} .........*/ static QState Pelican_pedsFlash(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_ENTRY_SIG: { BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0U]} */ if (me->flashCtr != 0U) { --me->flashCtr; /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[else]} */ else { BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[else]} */ else { status_ = Q_TRAN(&Pelican_carsEnabled); } break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::offline} .....................................*/ static QState Pelican_offline(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::offline} */ case Q_ENTRY_SIG: { BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { me->flashCtr ^= 1U; /*.${components::Pelican::SM::offline::Q_TIMEOUT::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::offline::Q_TIMEOUT::[else]} */ else { BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } break; } /*.${components::Pelican::SM::offline::ON} */ case ON_SIG: { status_ = Q_TRAN(&Pelican_operational); break; } /*.${components::Pelican::SM::offline::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/pelican.h ================================================ /*.$file${.::pelican.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ /*.$declare${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void); /*.$enddecl${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/pelican.qm ================================================ PEdestrian LIght CONtrolled (PELICAN) crossing example PEdestrian LIght CONtrolled (PELICAN) crossing BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); QF_stop(); BSP_signalCars(CARS_RED); BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("carsGreenNoPed"); BSP_showState("carsGreenInt"); BSP_showState("carsGreenPedWait"); BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_signalPeds(PEDS_DONT_WALK); BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; QActive_disarmX(&me->super, 0U); me->flashCtr != 0U --me->flashCtr; (me->flashCtr & 1U) == 0U BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalPeds(PEDS_BLANK); else BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; QActive_disarmX(&me->super, 0U); me->flashCtr ^= 1U; (me->flashCtr & 1U) == 0U BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); QF_stop(); constructor QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ $declare(components::Pelican_ctor) extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ $declare(components::Pelican) /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ $define(components::Pelican_ctor) $define(components::Pelican) ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/armclang/pelican-qk.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 pelican-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 pelican-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\pelican.c pelican.c 0 0 1 3 1 0 0 0 ..\..\main.c main.c 0 0 1 4 5 0 0 0 ..\..\pelican.h pelican.h 0 0 1 5 5 0 0 0 ..\..\qpn_conf.h qpn_conf.h 0 0 ek-tm4c123gxl 1 0 0 0 2 6 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 7 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 2 12 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 QP 1 0 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qkn\qkn.c qkn.c 0 0 QP_port 1 0 0 0 4 16 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qfn_port.h 0 0 4 17 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c qkn_port.c 0 0
================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/armclang/pelican-qk.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
pelican-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ pelican-qk 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\pelican-qk.bin .\dbg\pelican-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c pelican.c 1 ..\..\pelican.c main.c 1 ..\..\main.c pelican.h 5 ..\..\pelican.h qpn_conf.h 5 ..\..\qpn_conf.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c pelican-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ pelican-qk 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\pelican-qk.bin .\rel\pelican-qk.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qk\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 pelican-qk.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c pelican.c 1 ..\..\pelican.c main.c 1 ..\..\main.c pelican.h 5 ..\..\pelican.h qpn_conf.h 5 ..\..\qpn_conf.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qkn.c 1 ..\..\..\..\..\src\qkn\qkn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qk\armclang\qfn_port.h qkn_port.c 1 ..\..\..\..\..\ports\arm-cm\qk\armclang\qkn_port.c
================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/bsp.c ================================================ /***************************************************************************** * Product: PELICAN on EK-TM4C123GXL board, preemptive QK kernel * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "pelican.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1 and SW2 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_SW1) != 0U) { /* debounced SW1 state changed? */ if ((buttons.depressed & BTN_SW1) != 0U) { /* is SW1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U); } else { /* the button is released */ } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... * * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used only by active objects * and NOT in any ISR. This setting is very efficient, but if any ISRs * start using the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); } /*..........................................................................*/ void BSP_showState(char_t const *state) { (void)state; } /*..........................................................................*/ void BSP_signalCars(enum BSP_CarsSignal sig) { switch (sig) { case CARS_RED: { //GPIOF->DATA_Bits[LED_RED] = LED_RED; break; } case CARS_YELLOW: { //GPIOF->DATA_Bits[LED_RED | LED_GREEN] = (LED_RED | LED_GREEN); break; } case CARS_GREEN: { //GPIOF->DATA_Bits[LED_GREEN] = LED_GREEN; break; } case CARS_BLANK: { //GPIOF->DATA_Bits[LED_RED | LED_GREEN | LED_BLUE] = 0U; break; } } } /*..........................................................................*/ void BSP_signalPeds(enum BSP_PedsSignal sig) { switch (sig) { case PEDS_DONT_WALK: { GPIOF->DATA_Bits[LED_RED] = LED_RED; break; } case PEDS_BLANK: { GPIOF->DATA_Bits[LED_RED | LED_GREEN] = 0U; break; } case PEDS_WALK: { GPIOF->DATA_Bits[LED_RED | LED_GREEN] = LED_GREEN; break; } } } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE01 */ QF_INT_DISABLE(); GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M3 MCU. */ __WFI(); /* Wait-For-Interrupt */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QK-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := pelican-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ pelican.c \ bsp.c \ main.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c \ qkn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default) and Release. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/gnu/pelican-qk.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP/C framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script pelican-qk.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/iar/pelican-qk.ewd ================================================ 2 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 ANGEL_ID 2 0 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IARROM_ID 2 1 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 MACRAIGOR_ID 2 3 1 1 PEMICRO_ID 2 3 1 1 RDI_ID 2 2 1 1 STLINK_ID 2 3 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 5 1 1 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 ANGEL_ID 2 0 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IARROM_ID 2 1 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 MACRAIGOR_ID 2 3 1 0 PEMICRO_ID 2 3 1 0 RDI_ID 2 2 1 0 STLINK_ID 2 3 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 5 1 0 $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin 0 $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/iar/pelican-qk.ewp ================================================ 2 Debug ARM 1 General 3 24 1 1 ICCARM 2 31 1 1 AARM 2 9 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 17 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 24 1 0 ICCARM 2 31 1 0 AARM 2 9 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 17 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\pelican.c $PROJ_DIR$\..\..\pelican.h ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qk\iar\qkn_port.c ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/iar/pelican-qk.eww ================================================ $WS_DIR$\pelican-qk.ewp ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qk/iar/pelican-qk.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the PELICAN example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/armclang/README.txt ================================================ About this Example ================== This example demonstrates how to use the uVision IDE together with the MDK-ARM toolchain. *** NOTE: This example requires installing the following Software Pack in the Keil uVision: Keil::TM4C_DFP. *** uVision Project File ==================== The MDK-ARM uVision project file provided with this example uses relative paths to the QP framework location (includes, port, and libraries. These relative paths must be modified when the project is moved to different relative location. Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the command-line options for the ARM assembler (see the Asm tab in the "Options for Target" dialog box in uVision). Specifically, you should define symbols: Stack_Size=xxx Heap_Size=yyy, where xxx represents a numerical value of stack size and yyy the numerical value of the heap size (for most embedded projects yyy should be 0, as the using the heap is not recommended). Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/armclang/pelican-qv.uvoptx ================================================ 1.0
### uVision Project, (C) Keil Software
*.c *.s*; *.src; *.a* *.obj; *.o *.lib *.txt; *.h; *.inc *.plm *.cpp 0 0 0 pelican-dbg 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\dbg\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 4 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 UL2CM3 UL2CM3(-O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E2006F4 -O4622 -S4 -FO61 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 pelican-rel 0x4 ARM-ADS 12000000 1 1 1 0 0 1 65535 0 0 0 79 66 8 .\rel\ 1 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 4 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0 8 BIN\lmidk-agdi.dll 0 DLGUARM ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÈ`» ´­­ª¤ô 0 ARMRTXEVENTFLAGS -L70 -Z18 -C0 -M0 -T1 0 DLGTARM (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS 0 lmidk-agdi -U0E10259B -O4622 -S4 -FO61 0 UL2CM3 -O207 -S0 -C0 -FO7 -FN1 -FC1000 -FD20000000 -FF0TM4C123_256 -FL040000 -FS00 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM) 1 2 0x20000200 0 2 0 0x400 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Applicatioin 1 0 0 0 1 1 1 0 0 0 ..\bsp.c bsp.c 0 0 1 2 1 0 0 0 ..\..\main.c main.c 0 0 1 3 1 0 0 0 ..\..\pelican.c pelican.c 0 0 1 4 5 0 0 0 ..\..\pelican.h pelican.h 0 0 1 5 5 0 0 0 ..\..\qpn_conf.h qpn_conf.h 0 0 ek-tm4c123gxl 1 0 0 0 2 6 1 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c system_TM4C123GH6PM.c 0 0 2 7 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h TM4C123GH6PM.h 0 0 2 8 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h gpio.h 0 0 2 9 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h rom.h 0 0 2 10 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h sysctl.h 0 0 2 11 5 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h system_TM4C123GH6PM.h 0 0 2 12 2 0 0 0 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s startup_TM4C123GH6PM.s 0 0 QP 1 0 0 0 3 13 1 0 0 0 ..\..\..\..\..\src\qfn\qepn.c qepn.c 0 0 3 14 1 0 0 0 ..\..\..\..\..\src\qfn\qfn.c qfn.c 0 0 3 15 1 0 0 0 ..\..\..\..\..\src\qvn\qvn.c qvn.c 0 0 QP_port 1 0 0 0 4 16 5 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qfn_port.h 0 0 4 17 1 0 0 0 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c qvn_port.c 0 0
================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/armclang/pelican-qv.uvprojx ================================================ 2.1
### uVision Project, (C) Keil Software
pelican-dbg 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\dbg\ pelican-qv 1 0 0 1 1 .\dbg\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\dbg\pelican-qv.bin .\dbg\pelican-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c pelican.c 1 ..\..\pelican.c pelican.h 5 ..\..\pelican.h qpn_conf.h 5 ..\..\qpn_conf.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c pelican-rel 0x4 ARM-ADS 6130001::V6.13.1::.\ARMCLANG 1 TM4C123GH6PM Texas Instruments Keil.TM4C_DFP.1.1.0 http://www.keil.com/pack/ IROM(0x00000000,0x040000) IRAM(0x20000000,0x008000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0TM4C123_256 -FS00 -FL040000 -FP0($$Device:TM4C123GH6PM$Flash\TM4C123_256.FLM)) 0 $$Device:TM4C123GH6PM$Device\Include\TM4C123\TM4C123.h $$Device:TM4C123GH6PM$SVD\TM4C123\TM4C123GH6PM.svd 0 0 0 0 0 0 1 .\rel\ pelican-qv 1 0 0 0 0 .\rel\ 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 fromelf --bin --output .\rel\pelican-qv.bin .\rel\pelican-qv.axf 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 3 1 SARMCM3.DLL -MPU DCM.DLL -pCM4 SARMCM3.DLL -MPU TCM.DLL -pCM4 1 0 0 0 16 1 0 0 1 1 4097 1 BIN\UL2CM3.DLL 0 0 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 "Cortex-M4" 0 0 0 1 1 0 0 2 0 0 0 8 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 1 0x0 0x40000 0 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x0 1 0x0 0x40000 1 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x0 0x0 0 0x20000000 0x8000 0 0x0 0x0 0 7 0 0 1 0 0 0 0 0 3 0 1 0 0 0 3 3 1 1 0 0 0 NDEBUG __FPU_PRESENT ..\..;..\..\..\..\..\include;..\..\..\..\..\ports\arm-cm\qv\armclang;..\..\..\..\..\3rd_party\CMSIS\Include;..\..\..\..\..\3rd_party\ek-tm4c123gxl 1 0 0 0 0 0 0 1 0 0 Stack_Size=1024 Heap_Size=0 1 0 0 0 1 0 0x00000000 0x20000000 pelican-qv.sct --entry Reset_Handler Applicatioin bsp.c 1 ..\bsp.c main.c 1 ..\..\main.c pelican.c 1 ..\..\pelican.c pelican.h 5 ..\..\pelican.h qpn_conf.h 5 ..\..\qpn_conf.h ek-tm4c123gxl system_TM4C123GH6PM.c 1 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h gpio.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\gpio.h rom.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\rom.h sysctl.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\sysctl.h system_TM4C123GH6PM.h 5 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h startup_TM4C123GH6PM.s 2 ..\..\..\..\..\3rd_party\ek-tm4c123gxl\arm\startup_TM4C123GH6PM.s QP qepn.c 1 ..\..\..\..\..\src\qfn\qepn.c qfn.c 1 ..\..\..\..\..\src\qfn\qfn.c qvn.c 1 ..\..\..\..\..\src\qvn\qvn.c QP_port qfn_port.h 5 ..\..\..\..\..\ports\arm-cm\qv\armclang\qfn_port.h qvn_port.c 1 ..\..\..\..\..\ports\arm-cm\qv\armclang\qvn_port.c
================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/bsp.c ================================================ /***************************************************************************** * Product: PELICAN on EK-TM4C123GXL board, cooperative QV kernel * Last Updated for Version: 5.6.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "pelican.h" #include "TM4C123GH6PM.h" /* the device specific header (TI) */ #include "rom.h" /* the built-in ROM functions (TI) */ #include "sysctl.h" /* system control driver (TI) */ #include "gpio.h" /* GPIO driver (TI) */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ enum KernelUnawareISRs { /* see NOTE00 */ /* ... */ MAX_KERNEL_UNAWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-unaware" interrupts can't overlap "kernel-aware" interrupts */ Q_ASSERT_COMPILE(MAX_KERNEL_UNAWARE_CMSIS_PRI <= QF_AWARE_ISR_CMSIS_PRI); enum KernelAwareISRs { SYSTICK_PRIO = QF_AWARE_ISR_CMSIS_PRI, /* see NOTE00 */ /* ... */ MAX_KERNEL_AWARE_CMSIS_PRI /* keep always last */ }; /* "kernel-aware" interrupts should not overlap the PendSV priority */ Q_ASSERT_COMPILE(MAX_KERNEL_AWARE_CMSIS_PRI <= (0xFF >>(8-__NVIC_PRIO_BITS))); /* ISRs defined in this BSP ------------------------------------------------*/ void SysTick_Handler(void); void GPIOPortA_IRQHandler(void); /* Local-scope objects -----------------------------------------------------*/ #define LED_RED (1U << 1) #define LED_GREEN (1U << 3) #define LED_BLUE (1U << 2) #define BTN_SW1 (1U << 4) #define BTN_SW2 (1U << 0) /* ISRs used in this project ===============================================*/ void SysTick_Handler(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~GPIOF->DATA_Bits[BTN_SW1 | BTN_SW2]; /* read SW1 and SW2 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_SW1) != 0U) { /* debounced SW1 state changed? */ if ((buttons.depressed & BTN_SW1) != 0U) { /* is SW1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U); } else { /* the button is released */ } } } /* BSP functions ===========================================================*/ void BSP_init(void) { /* NOTE: SystemInit() already called from the startup code * but SystemCoreClock needs to be updated */ SystemCoreClockUpdate(); /* configure the FPU usage by choosing one of the options... * * Do NOT to use the automatic FPU state preservation and * do NOT to use the FPU lazy stacking. * * NOTE: * Use the following setting when FPU is used only by active objects * and NOT in any ISR. This setting is very efficient, but if any ISRs * start using the FPU, this can lead to corruption of the FPU registers. */ FPU->FPCCR &= ~((1U << FPU_FPCCR_ASPEN_Pos) | (1U << FPU_FPCCR_LSPEN_Pos)); /* enable clock for to the peripherals used by this application... */ SYSCTL->RCGCGPIO |= (1U << 5); /* enable Run mode for GPIOF */ /* configure the LEDs and push buttons */ GPIOF->DIR |= (LED_RED | LED_GREEN | LED_BLUE);/* set direction: output */ GPIOF->DEN |= (LED_RED | LED_GREEN | LED_BLUE); /* digital enable */ GPIOF->DATA_Bits[LED_RED] = 0; /* turn the LED off */ GPIOF->DATA_Bits[LED_GREEN] = 0; /* turn the LED off */ GPIOF->DATA_Bits[LED_BLUE] = 0; /* turn the LED off */ /* configure the Buttons */ GPIOF->DIR &= ~(BTN_SW1 | BTN_SW2); /* set direction: input */ ROM_GPIOPadConfigSet(GPIOF_BASE, (BTN_SW1 | BTN_SW2), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); } /*..........................................................................*/ void BSP_showState(char_t const *state) { (void)state; } /*..........................................................................*/ void BSP_signalCars(enum BSP_CarsSignal sig) { switch (sig) { case CARS_RED: { //GPIOF->DATA_Bits[LED_RED] = LED_RED; break; } case CARS_YELLOW: { //GPIOF->DATA_Bits[LED_RED | LED_GREEN] = (LED_RED | LED_GREEN); break; } case CARS_GREEN: { //GPIOF->DATA_Bits[LED_GREEN] = LED_GREEN; break; } case CARS_BLANK: { //GPIOF->DATA_Bits[LED_RED | LED_GREEN | LED_BLUE] = 0U; break; } } } /*..........................................................................*/ void BSP_signalPeds(enum BSP_PedsSignal sig) { switch (sig) { case PEDS_DONT_WALK: { GPIOF->DATA_Bits[LED_RED] = LED_RED; break; } case PEDS_BLANK: { GPIOF->DATA_Bits[LED_RED | LED_GREEN] = 0U; break; } case PEDS_WALK: { GPIOF->DATA_Bits[LED_RED | LED_GREEN] = LED_GREEN; break; } } } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set up the SysTick timer to fire at BSP_TICKS_PER_SEC rate */ SysTick_Config(SystemCoreClock / BSP_TICKS_PER_SEC); /* assing all priority bits for preemption-prio. and none to sub-prio. */ NVIC_SetPriorityGrouping(0U); /* set priorities of ALL ISRs used in the system, see NOTE00 * * !!!!!!!!!!!!!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * Assign a priority to EVERY ISR explicitly by calling NVIC_SetPriority(). * DO NOT LEAVE THE ISR PRIORITIES AT THE DEFAULT VALUE! */ NVIC_SetPriority(SysTick_IRQn, SYSTICK_PRIO); /* ... */ /* enable IRQs... */ } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* CATION: called with interrupts DISABLED, NOTE01 */ /* toggle LED2 on and then off, see NOTE02 */ GPIOF->DATA_Bits[LED_BLUE] = 0xFFU; GPIOF->DATA_Bits[LED_BLUE] = 0x00U; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular Cortex-M MCU. */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; NVIC_SystemReset(); } /***************************************************************************** * NOTE00: * The QF_AWARE_ISR_CMSIS_PRI constant from the QF port specifies the highest * ISR priority that is disabled by the QF framework. The value is suitable * for the NVIC_SetPriority() CMSIS function. * * Only ISRs prioritized at or below the QF_AWARE_ISR_CMSIS_PRI level (i.e., * with the numerical values of priorities equal or higher than * QF_AWARE_ISR_CMSIS_PRI) are allowed to call any QF services. These ISRs * are "QF-aware". * * Conversely, any ISRs prioritized above the QF_AWARE_ISR_CMSIS_PRI priority * level (i.e., with the numerical values of priorities less than * QF_AWARE_ISR_CMSIS_PRI) are never disabled and are not aware of the kernel. * Such "QF-unaware" ISRs cannot call any QF services. The only mechanism * by which a "QF-unaware" ISR can communicate with the QF framework is by * triggering a "QF-aware" ISR, which can post/publish events. * * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE02: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano on EK-TM4C123GXL, QV-nano, GNU-ARM # Last Updated for Version: 6.5.0 # Date of the Last Update: 2019-04-15 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := pelican-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/arm-cm/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) \ $(QPN)/3rd_party/ek-tm4c123gxl \ $(QPN)/3rd_party/ek-tm4c123gxl/gnu # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) \ -I$(QPN)/3rd_party/CMSIS/Include \ -I$(QPN)/3rd_party/ek-tm4c123gxl #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ pelican.c \ bsp.c \ main.c \ system_TM4C123GH6PM.c \ startup_TM4C123GH6PM.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c \ qvn_port.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # ARM CPU, ARCH, FPU, and Float-ABI types... # ARM_CPU: [cortex-m0 | cortex-m0plus | cortex-m1 | cortex-m3 | cortex-m4] # ARM_ARCH: [6 | 7] (NOTE: must match ARM_CPU!) # ARM_FPU: [ | vfp] # FLOAT_ABI: [ | soft | softfp | hard] # ARM_CPU := -mcpu=cortex-m4 ARM_ARCH := 7 # NOTE: must match the ARM_CPU! ARM_FPU := -mfpu=vfp FLOAT_ABI := -mfloat-abi=softfp #----------------------------------------------------------------------------- # GNU-ARM toolset (NOTE: You need to adjust to your machine) # see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads # ifeq ($(GNU_ARM),) GNU_ARM := $(QTOOLS)/gnu_arm-none-eabi endif # make sure that the GNU-ARM toolset exists... ifeq ("$(wildcard $(GNU_ARM))","") $(error GNU_ARM toolset not found. Please adjust the Makefile) endif CC := $(GNU_ARM)/bin/arm-none-eabi-gcc CPP := $(GNU_ARM)/bin/arm-none-eabi-g++ AS := $(GNU_ARM)/bin/arm-none-eabi-as LINK := $(GNU_ARM)/bin/arm-none-eabi-g++ BIN := $(GNU_ARM)/bin/arm-none-eabi-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M # # combine all the soruces... C_SRCS += $(QP_SRCS) ASM_SRCS += $(QP_ASMS) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O1 $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration .......................................... BIN_DIR := dbg ASFLAGS = -g $(ARM_CPU) $(ARM_FPU) $(ASM_CPU) $(ASM_FPU) CFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ...................................................................... LINKFLAGS = -T$(LD_SCRIPT) $(ARM_CPU) $(ARM_FPU) $(FLOAT_ABI) -mthumb \ -specs=nosys.specs -specs=nano.specs \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_BIN := $(BIN_DIR)/$(OUTPUT).bin TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_BIN) #all: $(TARGET_ELF) $(TARGET_BIN): $(TARGET_ELF) $(BIN) -O binary $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(CC) $(CFLAGS) $(QPN)/include/qstamp.c -o $(BIN_DIR)/qstamp.o $(LINK) $(LINKFLAGS) -o $@ $^ $(BIN_DIR)/qstamp.o $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.bin \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be imported as a Makefile-based project into Eclipse-based IDEs. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. Also, the Makefile has been specifically designed to work as an external Makefile with the Eclipse CDT. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean *** NOTE: The installation folder of the GNU-ARM toolset on YOUR machine needs to be adjusted in the provided Makefile, by editing the symbol: GNU_ARM. As described in the comment for this symbol, the GNU-ARM toolset is taken from: http://gnutoolchains.com/arm-eabi It is highly recommened to use the same GNU-ARM distribution, especially for ARM Cortex-M4F projects, due to the support for the hardware FPU (float-abi=hard). *** Adjusting Stack and Heap Sizes ============================== The stack and heap sizes are determined in this project by the GCC linker script (.ld file), which provides a template of the recommended GCC linker script for QP applications. Startup Code ============ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\gcc\startup_TM4C123GH6PM.c The file startup_TM4C123GH6PM.c provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/gnu/flash.bat ================================================ ::============================================================================ :: Batch file to program the flash of EK-TM4C123GXL :: :: NOTE: requires the LMFlash programmer (included in QTools for Windows) :: @echo off setlocal @echo Load a given binary file to the flash of EK-TM4C123GXL @echo usage: flash binary-file @echo example: flash dbg\blinky-qk.bin ::---------------------------------------------------------------------------- :: NOTE: The following symbol LMFLASH assumes that LMFlash.exe can :: be found on the PATH. You might need to adjust this symbol to the :: location of the LMFlash utility on your machine :: set LMFLASH=LMFlash.exe if ["%~1"]==[""] ( @echo The binary file missing @goto end ) if not exist %~s1 ( @echo The binary file '%1' does not exist @goto end ) %LMFLASH% -q ek-tm4c123gxl -e -v -r %1 :end endlocal ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/gnu/pelican-qv.ld ================================================ /***************************************************************************** * Product: Linker script for EK-TM4C123GXL, GNU-ARM linker * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-13 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : http://www.state-machine.com * Email: info@state-machine.com *****************************************************************************/ OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(Reset_Handler) /* entry Point */ MEMORY { /* memory map of Tiva TM4C123GH6PM */ ROM (rx) : ORIGIN = 0x00000000, LENGTH = 256K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K } /* The size of the stack used by the application. NOTE: you need to adjust */ STACK_SIZE = 1024; /* The size of the heap used by the application. NOTE: you need to adjust */ HEAP_SIZE = 0; SECTIONS { .isr_vector : { /* the vector table goes FIRST into ROM */ KEEP(*(.isr_vector)) /* vector table */ . = ALIGN(4); } >ROM .text : { /* code and constants */ . = ALIGN(4); *(.text) /* .text sections (code) */ *(.text*) /* .text* sections (code) */ *(.rodata) /* .rodata sections (constants, strings, etc.) */ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ KEEP (*(.init)) KEEP (*(.fini)) . = ALIGN(4); } >ROM .preinit_array : { PROVIDE_HIDDEN (__preinit_array_start = .); KEEP (*(.preinit_array*)) PROVIDE_HIDDEN (__preinit_array_end = .); } >ROM .init_array : { PROVIDE_HIDDEN (__init_array_start = .); KEEP (*(SORT(.init_array.*))) KEEP (*(.init_array*)) PROVIDE_HIDDEN (__init_array_end = .); } >ROM .fini_array : { PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(.fini_array*)) KEEP (*(SORT(.fini_array.*))) PROVIDE_HIDDEN (__fini_array_end = .); } >ROM _etext = .; /* global symbols at end of code */ .stack : { __stack_start__ = .; . = . + STACK_SIZE; . = ALIGN(4); __stack_end__ = .; } >RAM .data : AT (_etext) { __data_load = LOADADDR (.data); __data_start = .; *(.data) /* .data sections */ *(.data*) /* .data* sections */ . = ALIGN(4); __data_end__ = .; _edata = __data_end__; } >RAM .bss : { __bss_start__ = .; *(.bss) *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; /* define a global symbol at bss end */ __bss_end__ = .; } >RAM __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } >RAM __exidx_end = .; PROVIDE ( end = _ebss ); PROVIDE ( _end = _ebss ); PROVIDE ( __end__ = _ebss ); .heap : { __heap_start__ = .; . = . + HEAP_SIZE; . = ALIGN(4); __heap_end__ = .; } >RAM /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } } ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/iar/README.txt ================================================ About this Example ================== This example demonstrates how to use the IAR EWARM IDE to build a QP application. IAR Project File ---------------- The IAR EWARM project file provided with this example uses relative paths to the QP-nano framework location. These relative paths must be modified when the project is moved to different relative location. Stack Size and Heap Size ------------------------ In this project, the size of the C stack and heap are determined in the linker script pelican-qv.icf (see the next section). Linker Script ------------- The IAR linker script provides a template of the recommended linker script for QP applications. This file needs to be customized to set the application-specific sizes of the Stack and Heap. This file can be edited from the IAR EWARM IDE via the Project Options/Linker settings. Startup Code ------------ The startup code for the TM4C123GH6PM MCU used in this project is located in the "3rd_party" folder in the following location: 3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s The file startup_TM4C123GH6PM.s provides a template of the recommended startup for QP applications and should be easily customizable for other ARM Cortex-M microcontrollers. The startup file typically does not need to be modified or adapted for applications. It provides only weak definitions of all exception and interrupt handlers, as well as the assert_failed() function. The weak function assert_failed() defined in this file might be re-defined in the application to customize it for the application-specific error- handling policy. *** NOTE: The function assert_failed() typically should NOT use the stack, because stack might be corrupted by the time this function is called. Also, assert_failed() is intended to handle catastrophic errors and should NOT return. *** ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/iar/pelican-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/iar/pelican-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\pelican.c $PROJ_DIR$\..\..\pelican.h $PROJ_DIR$\..\..\qpn_conf.h ek-tm4c123gxl $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\iar\startup_TM4C123GH6PM.s $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.c $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\system_TM4C123GH6PM.h $PROJ_DIR$\..\..\..\..\..\3rd_party\ek-tm4c123gxl\TM4C123GH6PM.h QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm-cm\qv\iar\qvn_port.c ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/iar/pelican-qv.eww ================================================ $WS_DIR$\pelican-qv.ewp ================================================ FILE: examples/arm-cm/pelican_ek-tm4c123gxl/qv/iar/pelican-qv.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00000000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00000000; define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 1024; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place at start of RAM_region {block CSTACK }; place in RAM_region { readwrite, block HEAP }; ================================================ FILE: examples/arm7-9/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/exa_arm7-9.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm7-9_dpp_at91sam7s-ek.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qk/iar/at91SAM7S64.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00100000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00100000; define symbol __ICFEDIT_region_ROM_end__ = 0x0010FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; define symbol __ICFEDIT_region_RAM_end__ = 0x00203FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 0x400; define symbol __ICFEDIT_size_svcstack__ = 0; define symbol __ICFEDIT_size_irqstack__ = 0; define symbol __ICFEDIT_size_fiqstack__ = 0; define symbol __ICFEDIT_size_undstack__ = 0; define symbol __ICFEDIT_size_abtstack__ = 0; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size 0x40]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ + 0x40 to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in VEC_region { section .vectors }; place in RAM_region { readwrite, block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, block UND_STACK, block ABT_STACK, block HEAP }; ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qk/iar/bsp.c ================================================ /***************************************************************************** * Product: DPP on AT91SAM7S-EK board, preemptive QK kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "AT91SAM7S64.h" /* Atmel AT91SAM7S64 MCU */ //Q_DEFINE_THIS_FILE #pragma diag_suppress=Ta021 /* call __iar_disable_interrupt from __ramfunc */ #pragma diag_suppress=Ta022 /* possible ROM access from __ramfunc */ #pragma diag_suppress=Ta023 /* call to non __ramfunc from __ramfunc */ /* Local objects -----------------------------------------------------------*/ typedef void (*IntVector)(void); /* IntVector pointer-to-function */ uint32_t get_MCK_FREQ(void); /* CPU clock set up in __low_level_init() */ uint32_t const l_led[] = { (1U << 0), /* LED D1 on AT91SAM7S-EK */ (1U << 1), /* LED D2 on AT91SAM7S-EK */ (1U << 2), /* LED D3 on AT91SAM7S-EK */ (1U << 3) /* LED D4 on AT91SAM7S-EK */ }; #define LED_ON(num_) (AT91C_BASE_PIOA->PIO_CODR = l_led[num_]) #define LED_OFF(num_) (AT91C_BASE_PIOA->PIO_SODR = l_led[num_]) uint32_t const l_btn[] = { (1U << 19), /* BTN P1 on AT91SAM7S-EK */ (1U << 20), /* BTN P2 on AT91SAM7S-EK */ (1U << 14), /* BTN P3 on AT91SAM7S-EK */ (1U << 15) /* BTN P4 on AT91SAM7S-EK */ }; /* random seed */ static uint32_t l_rnd; /* ISRs and ISR "wrappers" ================================================*/ __ramfunc void BSP_irq(void) { IntVector vect = (IntVector)AT91C_BASE_AIC->AIC_IVR; /* read the IVR */ AT91C_BASE_AIC->AIC_IVR = (AT91_REG)vect; /* write AIC_IVR if protected */ QF_INT_ENABLE(); /* allow nesting interrupts */ (*vect)(); /* call the IRQ ISR via the pointer to function */ QF_INT_DISABLE(); /* disable interrups for the exit sequence */ AT91C_BASE_AIC->AIC_EOICR = 0; /* write AIC_EOICR to clear interrupt */ } /* ISRs --------------------------------------------------------------------*/ __ramfunc static void ISR_tick(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t volatile tmp; /* clear the interrupt source */ tmp = AT91C_BASE_PITC->PITC_PIVR; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~AT91C_BASE_PIOA->PIO_PDSR;/* read PIOA with state of Buttons */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & l_btn[0]) != 0U) { /* debounced BTN_P1 state changed? */ if ((buttons.depressed & l_btn[0]) != 0U) { /* is BTN_P1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /*..........................................................................*/ __ramfunc static void ISR_spur(void) { } /* BSP functions ===========================================================*/ void BSP_init(void) { uint32_t i; /* When using the JTAG debugger the AIC might not be initialised * to the correct default state. This line ensures that AIC does not * mask all interrupts at the start. */ AT91C_BASE_AIC->AIC_EOICR = 0U; /* enable peripheral clock for PIOA */ AT91C_BASE_PMC->PMC_PCER = (1U << AT91C_ID_PIOA); /* initialize the LEDs... */ for (i = 0; i < Q_DIM(l_led); ++i) { AT91C_BASE_PIOA->PIO_PER = l_led[i]; /* enable pin */ AT91C_BASE_PIOA->PIO_OER = l_led[i]; /* configure as output pin */ LED_OFF(i); /* extinguish the LED */ } /* initialize the Buttons... */ for (i = 0; i < Q_DIM(l_btn); ++i) { AT91C_BASE_PIOA->PIO_ODR = l_btn[i]; /* disable output (input pin) */ AT91C_BASE_PIOA->PIO_PER = l_btn[i]; /* enable pin */ } /* configure Advanced Interrupt Controller (AIC) of AT91... */ AT91C_BASE_AIC->AIC_IDCR = ~0; /* disable all interrupts */ AT91C_BASE_AIC->AIC_ICCR = ~0; /* clear all interrupts */ for (i = 0; i < 8; ++i) { AT91C_BASE_AIC->AIC_EOICR = 0; /* write AIC_EOICR 8 times */ } /* set the desired ticking rate for the PIT... */ i = (get_MCK_FREQ() / 16U / BSP_TICKS_PER_SEC) - 1U; AT91C_BASE_PITC->PITC_PIMR = (AT91C_PITC_PITEN | AT91C_PITC_PITIEN | i); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { LED_ON(0); /* turn LED on */ } else { LED_OFF(0); /* turn LED off */ } if (stat[0] == 'e') { LED_ON(1); /* turn LED on */ } else { LED_OFF(1); /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != (uint8_t)0) { LED_ON(2); /* turn LED on */ } else { LED_OFF(2); /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* hook the exception handlers from the QF port... */ *(uint32_t volatile *)0x24 = (uint32_t)&QF_undef; *(uint32_t volatile *)0x28 = (uint32_t)&QF_swi; *(uint32_t volatile *)0x2C = (uint32_t)&QF_pAbort; *(uint32_t volatile *)0x30 = (uint32_t)&QF_dAbort; *(uint32_t volatile *)0x34 = (uint32_t)&QF_reserved; *(uint32_t volatile *)0x38 = (uint32_t)&QK_irq; *(uint32_t volatile *)0x3C = (uint32_t)0; /* QK_fiq unimplemented! */ AT91C_BASE_AIC->AIC_SVR[AT91C_ID_SYS] = (uint32_t)&ISR_tick; AT91C_BASE_AIC->AIC_SPU = (uint32_t)&ISR_spur; /* spurious IRQ */ AT91C_BASE_AIC->AIC_SMR[AT91C_ID_SYS] = (AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | AT91C_AIC_PRIOR_LOWEST); AT91C_BASE_AIC->AIC_ICCR = (1 << AT91C_ID_SYS); AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_SYS); } /*..........................................................................*/ __ramfunc void QK_onIdle(void) { /* toggle first LED on and off, see NOTE01 */ QF_INT_DISABLE(); LED_ON(3); /* turn LED on */ LED_OFF(3); /* turn LED off */ QF_INT_ENABLE(); #ifdef NDEBUG /* only if not debugging (idle mode hinders debugging) */ AT91C_BASE_PMC->PMC_SCDR = 1;/* Power-Management: disable the CPU clock */ /* NOTE: an interrupt starts the CPU clock again */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { QF_INT_DISABLE(); /* disable all interrupts */ /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; /* trip the Watchdog to reset the system */ AT91C_BASE_WDTC->WDTC_WDCR = (0xA5U << 24) | AT91C_WDTC_WDRSTT; /* hang in here until the reset occurrs */ for (;;) { } } /***************************************************************************** * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qk/iar/dpp-qk.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qk/iar/dpp-qk.ewp ================================================ 3 Debug ARM 1 General 3 31 1 1 ICCARM 2 35 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 23 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 31 1 0 ICCARM 2 35 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 23 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\bsp.c Debug ICCARM 35 0 1 Release ICCARM 35 0 0 $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c AT91SAM7S-EK $PROJ_DIR$\..\..\..\..\..\3rd_party\at91sam7s-ek\iar\low_level_init.c $PROJ_DIR$\..\..\..\..\..\3rd_party\at91sam7s-ek\iar\startup_at91mc.s Debug ICCARM 35 0 1 Release ICCARM 35 0 0 QP_ARM $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c Debug ICCARM 35 0 1 Release ICCARM 35 0 0 QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm7-9\qk\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm7-9\qk\iar\qkn_port.s QP_THUMB $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qv/iar/at91SAM7S64.icf ================================================ /*###ICF### Section handled by ICF editor, don't touch! ****/ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */ /*-Specials-*/ define symbol __ICFEDIT_intvec_start__ = 0x00100000; /*-Memory Regions-*/ define symbol __ICFEDIT_region_ROM_start__ = 0x00100000; define symbol __ICFEDIT_region_ROM_end__ = 0x0010FFFF; define symbol __ICFEDIT_region_RAM_start__ = 0x00200000; define symbol __ICFEDIT_region_RAM_end__ = 0x00203FFF; /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 0x400; define symbol __ICFEDIT_size_svcstack__ = 0; define symbol __ICFEDIT_size_irqstack__ = 0; define symbol __ICFEDIT_size_fiqstack__ = 0; define symbol __ICFEDIT_size_undstack__ = 0; define symbol __ICFEDIT_size_abtstack__ = 0; define symbol __ICFEDIT_size_heap__ = 0; /**** End of ICF editor section. ###ICF###*/ define memory mem with size = 4G; define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size 0x40]; define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ + 0x40 to __ICFEDIT_region_RAM_end__]; define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { }; define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { }; define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { }; define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { }; define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { }; define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; initialize by copy { readwrite }; do not initialize { section .noinit }; place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; place in ROM_region { readonly }; place in VEC_region { section .vectors }; place in RAM_region { readwrite, block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK, block UND_STACK, block ABT_STACK, block HEAP }; ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qv/iar/bsp.c ================================================ /***************************************************************************** * Product: DPP on AT91SAM7S-EK board, cooperative QV kernel * Last Updated for Version: 5.5.1 * Date of the Last Update: 2015-10-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "AT91SAM7S64.h" /* Atmel AT91SAM7S64 MCU */ //Q_DEFINE_THIS_FILE #pragma diag_suppress=Ta021 /* call __iar_disable_interrupt from __ramfunc */ #pragma diag_suppress=Ta022 /* possible ROM access from __ramfunc */ #pragma diag_suppress=Ta023 /* call to non __ramfunc from __ramfunc */ /* Local objects -----------------------------------------------------------*/ typedef void (*IntVector)(void); /* IntVector pointer-to-function */ uint32_t get_MCK_FREQ(void); /* CPU clock set up in __low_level_init() */ uint32_t const l_led[] = { (1U << 0), /* LED D1 on AT91SAM7S-EK */ (1U << 1), /* LED D2 on AT91SAM7S-EK */ (1U << 2), /* LED D3 on AT91SAM7S-EK */ (1U << 3) /* LED D4 on AT91SAM7S-EK */ }; #define LED_ON(num_) (AT91C_BASE_PIOA->PIO_CODR = l_led[num_]) #define LED_OFF(num_) (AT91C_BASE_PIOA->PIO_SODR = l_led[num_]) uint32_t const l_btn[] = { (1U << 19), /* BTN P1 on AT91SAM7S-EK */ (1U << 20), /* BTN P2 on AT91SAM7S-EK */ (1U << 14), /* BTN P3 on AT91SAM7S-EK */ (1U << 15) /* BTN P4 on AT91SAM7S-EK */ }; /* random seed */ static uint32_t l_rnd; /* ISRs and ISR "wrappers" ================================================*/ __ramfunc void BSP_irq(void) { IntVector vect = (IntVector)AT91C_BASE_AIC->AIC_IVR; /* read the IVR */ AT91C_BASE_AIC->AIC_IVR = (AT91_REG)vect; /* write AIC_IVR if protected */ QF_INT_ENABLE(); /* allow nesting interrupts */ (*vect)(); /* call the IRQ ISR via the pointer to function */ QF_INT_DISABLE(); /* disable interrups for the exit sequence */ AT91C_BASE_AIC->AIC_EOICR = 0; /* write AIC_EOICR to clear interrupt */ } /* ISRs --------------------------------------------------------------------*/ __ramfunc static void ISR_tick(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint32_t depressed; uint32_t previous; } buttons = { ~0U, ~0U }; uint32_t current; uint32_t volatile tmp; /* clear the interrupt source */ tmp = AT91C_BASE_PITC->PITC_PIVR; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~AT91C_BASE_PIOA->PIO_PDSR;/* read PIOA with state of Buttons */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & l_btn[0]) != 0U) { /* debounced BTN_P1 state changed? */ if ((buttons.depressed & l_btn[0]) != 0U) { /* is BTN_P1 depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /*..........................................................................*/ __ramfunc static void ISR_spur(void) { } /* BSP functions ===========================================================*/ void BSP_init(void) { uint32_t i; /* When using the JTAG debugger the AIC might not be initialised * to the correct default state. This line ensures that AIC does not * mask all interrupts at the start. */ AT91C_BASE_AIC->AIC_EOICR = 0U; /* enable peripheral clock for PIOA */ AT91C_BASE_PMC->PMC_PCER = (1U << AT91C_ID_PIOA); /* initialize the LEDs... */ for (i = 0; i < Q_DIM(l_led); ++i) { AT91C_BASE_PIOA->PIO_PER = l_led[i]; /* enable pin */ AT91C_BASE_PIOA->PIO_OER = l_led[i]; /* configure as output pin */ LED_OFF(i); /* extinguish the LED */ } /* initialize the Buttons... */ for (i = 0; i < Q_DIM(l_btn); ++i) { AT91C_BASE_PIOA->PIO_ODR = l_btn[i]; /* disable output (input pin) */ AT91C_BASE_PIOA->PIO_PER = l_btn[i]; /* enable pin */ } /* configure Advanced Interrupt Controller (AIC) of AT91... */ AT91C_BASE_AIC->AIC_IDCR = ~0; /* disable all interrupts */ AT91C_BASE_AIC->AIC_ICCR = ~0; /* clear all interrupts */ for (i = 0; i < 8; ++i) { AT91C_BASE_AIC->AIC_EOICR = 0; /* write AIC_EOICR 8 times */ } /* set the desired ticking rate for the PIT... */ i = (get_MCK_FREQ() / 16U / BSP_TICKS_PER_SEC) - 1U; AT91C_BASE_PITC->PITC_PIMR = (AT91C_PITC_PITEN | AT91C_PITC_PITIEN | i); BSP_randomSeed(1234U); /* seed the random number generator */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { LED_ON(0); /* turn LED on */ } else { LED_OFF(0); /* turn LED off */ } if (stat[0] == 'e') { LED_ON(1); /* turn LED on */ } else { LED_OFF(1); /* turn LED off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { if (paused != (uint8_t)0) { LED_ON(2); /* turn LED on */ } else { LED_OFF(2); /* turn LED off */ } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* hook the exception handlers from the QF port... */ *(uint32_t volatile *)0x24 = (uint32_t)&QF_undef; *(uint32_t volatile *)0x28 = (uint32_t)&QF_swi; *(uint32_t volatile *)0x2C = (uint32_t)&QF_pAbort; *(uint32_t volatile *)0x30 = (uint32_t)&QF_dAbort; *(uint32_t volatile *)0x34 = (uint32_t)&QF_reserved; *(uint32_t volatile *)0x38 = (uint32_t)&QV_irq; *(uint32_t volatile *)0x3C = (uint32_t)0; /* QV_fiq unimplemented! */ AT91C_BASE_AIC->AIC_SVR[AT91C_ID_SYS] = (uint32_t)&ISR_tick; AT91C_BASE_AIC->AIC_SPU = (uint32_t)&ISR_spur; /* spurious IRQ */ AT91C_BASE_AIC->AIC_SMR[AT91C_ID_SYS] = (AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | AT91C_AIC_PRIOR_LOWEST); AT91C_BASE_AIC->AIC_ICCR = (1 << AT91C_ID_SYS); AT91C_BASE_AIC->AIC_IECR = (1 << AT91C_ID_SYS); } /*..........................................................................*/ __ramfunc void QV_onIdle(void) { /* NOTE: called with interrupts DISABLED */ /* toggle first LED on and off, see NOTE01 */ LED_ON(3); /* turn LED on */ LED_OFF(3); /* turn LED off */ #ifdef NDEBUG /* only if not debugging (idle mode hinders debugging) */ AT91C_BASE_PMC->PMC_SCDR = 1;/* Power-Management: disable the CPU clock */ /* NOTE: an interrupt starts the CPU clock again */ QF_INT_ENABLE(); /* enable interrupts as soon as CPU clock starts */ #else QF_INT_ENABLE(); #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int loc) { QF_INT_DISABLE(); /* disable all interrupts */ /* * NOTE: add here your application-specific error handling */ (void)module; (void)loc; /* trip the Watchdog to reset the system */ AT91C_BASE_WDTC->WDTC_WDCR = (0xA5U << 24) | AT91C_WDTC_WDRSTT; /* hang in here until the reset occurrs */ for (;;) { } } /***************************************************************************** * NOTE01: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qv/iar/dpp-qv.ewd ================================================ 3 Debug ARM 1 C-SPY 2 28 1 1 ARMSIM_ID 2 1 1 1 CADI_ID 2 0 1 1 CMSISDAP_ID 2 4 1 1 GDBSERVER_ID 2 0 1 1 IJET_ID 2 8 1 1 JLINK_ID 2 16 1 1 LMIFTDI_ID 2 2 1 1 PEMICRO_ID 2 3 1 1 STLINK_ID 2 4 1 1 THIRDPARTY_ID 2 0 1 1 TIFET_ID 2 1 1 1 XDS100_ID 2 6 1 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release ARM 0 C-SPY 2 28 1 0 ARMSIM_ID 2 1 1 0 CADI_ID 2 0 1 0 CMSISDAP_ID 2 4 1 0 GDBSERVER_ID 2 0 1 0 IJET_ID 2 8 1 0 JLINK_ID 2 16 1 0 LMIFTDI_ID 2 2 1 0 PEMICRO_ID 2 3 1 0 STLINK_ID 2 4 1 0 THIRDPARTY_ID 2 0 1 0 TIFET_ID 2 1 1 0 XDS100_ID 2 6 1 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qv/iar/dpp-qv.ewp ================================================ 3 Debug ARM 1 General 3 28 1 1 ICCARM 2 34 1 1 AARM 2 10 1 1 OBJCOPY 0 1 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 1 IARCHIVE 0 0 1 1 BILINK 0 Coder 0 Release ARM 0 General 3 28 1 0 ICCARM 2 34 1 0 AARM 2 10 1 0 OBJCOPY 0 1 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 ILINK 0 20 1 0 IARCHIVE 0 0 1 0 BILINK 0 Coder 0 Application $PROJ_DIR$\bsp.c Debug ICCARM 34 0 1 Release ICCARM 34 0 0 $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c AT91SAM7S-EK $PROJ_DIR$\..\..\..\..\..\3rd_party\at91sam7s-ek\iar\low_level_init.c $PROJ_DIR$\..\..\..\..\..\3rd_party\at91sam7s-ek\iar\startup_at91mc.s Debug ICCARM 34 0 1 Release ICCARM 34 0 0 QP_ARM $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c Debug ICCARM 34 0 1 Release ICCARM 34 0 0 QP_port $PROJ_DIR$\..\..\..\..\..\ports\arm7-9\qv\iar\qfn_port.h $PROJ_DIR$\..\..\..\..\..\ports\arm7-9\qv\iar\qvn_port.s QP_THUMB $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/arm7-9/dpp_at91sam7s-ek/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/avr/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/exa_avr.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/avr/blinky_arduino-uno/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/avr_blinky_arduino-uno.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/avr/blinky_arduino-uno/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/avr/blinky_arduino-uno/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/avr/blinky_arduino-uno/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/avr/blinky_arduino-uno/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/avr/blinky_arduino-uno/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano, Arduino-UNO, preemptive QK kernel, GNU-AVR # Last Updated for Version: 5.4.0 # Date of the Last Update: 2015-05-28 # # Q u a n t u m L e a P s # --------------------------- # innovating embedded systems # # Copyright (C) Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # Web: http://www.state-machine.com # Email: info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/avr/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qkn.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # AVR MCU type AVR_MCU=atmega328p #----------------------------------------------------------------------------- # GNU-AVR toolset (NOTE: You need to adjust to your machine) # see http://sourceforge.net/projects/winavr # ifeq ($(GNU_AVR),) GNU_AVR = C:\tools\WinAVR endif # make sure that the GNU-AVR toolset exists... ifeq ("$(wildcard $(GNU_AVR))","") $(error GNU_AVR toolset not found. Please adjust the Makefile) endif CC := $(GNU_AVR)/bin/avr-gcc CPP := $(GNU_AVR)/bin/avr-g++ AS := $(GNU_AVR)/bin/avr-as LINK := $(GNU_AVR)/bin/avr-gcc BIN := $(GNU_AVR)/bin/avr-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M4F # # combine all the soruces... C_SRCS += $(QP_SRCS) $(QP_PORT) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := dbg ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS = -mmcu=$(AVR_MCU) \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_HEX := $(BIN_DIR)/$(OUTPUT).hex TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_HEX) #all: $(TARGET_ELF) $(TARGET_HEX): $(TARGET_ELF) $(BIN) -O ihex $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) -c $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.hex \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/avr/blinky_arduino-uno/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be invoked directly (via the make utility) from the QM modeling tool. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean Warning: '__progmem__' attribute ignored ======================================== AVR is a Harvard architecture that uses different program and data spaces as well as different CPU instructions to access these two address spaces (data memory is 8-bit wide while program memory is 16-bit wide). Consequently, one of the biggest concerns in AVR programs is to correctly allocate and access constant data in the program space (ROM) rather than the precious RAM. Since the ROM resides in a different address space, you need to tell the compiler to place variables there. You also need a way to access the data (i.e., the compiler has to use the lpm instruction.) The GNU-AVR compiler supports data in the program memory only partially through the attribute((progmem)) extension (typically used through the PROGMEM macro). By tagging a variable with attribute((progmem)), you can force it to reside in the ROM. However, the compiler support ends at this point. It is the responsibility of the developer to correctly access the PROGMEM variables. The GCC-AVR provides merely a bunch of macros (all defined in the avr\pgmspace.h header file). The bottom line is that the GNU-AVR compiler support for ROM-allocated objects through the PROGMEM attribute is both incomplete and inconsistent with the correct implementation in other compilers (such as IAR-AVR). For example, pointers pointing to PROGMEM objects are not treated correctly, meaning that the compiler will not generate the right code to access such ROM objects (the GNU-AVR compiler needs a kludge in form of macros such as pgm_read_byte_near and others). To recognize that fact, the GNU-AVR generates the warnings "'progmem' attribute ignored ". However, the QP source code is written for a standard correct implementation (how else would you achieve portability?). For example, the IAR-AVR compiler uses the attribute '__flash' to designate objects and pointers to ROM objects. The compiler then generates the right code for all such flash objects and pointers, without any kludges necessary for the GNU compiler. In summary, the warnings "'progmem' attribute ignored" should be ignored in the QP library build. To avoid these warnings, the QP source code would have to be modified in such a way that it would be incorrect for other compilers that handle these declarations correctly. ================================================ FILE: examples/avr/blinky_arduino-uno/qk/gnu/bsp.c ================================================ /***************************************************************************** * Product: Blinky example, Arduino-UNO board, preemptive QK-nano kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-08 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" /* the AVR device specific header is already included */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO */ #define LED_L (1U << 5) /* ISRs used in this project ===============================================*/ ISR(TIMER2_COMPA_vect) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { DDRB = 0xFFU; // All PORTB pins are outputs (user LED) PORTB = 0x00U; // drive all pins low } /*..........................................................................*/ void BSP_ledOff(void) { PORTB &= ~LED_L; } /*..........................................................................*/ void BSP_ledOn(void) { PORTB |= LED_L; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //QF_INT_DISABLE(); //PORTB |= LED_L; //PORTB &= ~LED_L; //QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QK_CPU_SLEEP(); /* put CPU to sleep */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE1: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/blinky_arduino-uno/qk/gnu/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/blinky_arduino-uno/qk/iar/blinky-qk.ewd ================================================ 2 Debug AVR 1 C-SPY 6 16 1 1 ATMELICEAVR 5 1 1 1 AVRONE 4 4 1 1 CCRAVR 2 1 1 1 ICE200AVR 2 1 1 1 JTAGICEAVR 3 2 1 1 JTAGICE3AVR 5 6 1 1 JTAGICEMKIIAVR 5 7 1 1 DRAGONAVR 3 3 1 1 SIMAVR 2 1 1 1 THIRDPARTYAVR 2 1 1 1 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release AVR 0 C-SPY 6 16 1 0 ATMELICEAVR 5 1 1 0 AVRONE 4 4 1 0 CCRAVR 2 1 1 0 ICE200AVR 2 1 1 0 JTAGICEAVR 3 2 1 0 JTAGICE3AVR 5 6 1 0 JTAGICEMKIIAVR 5 7 1 0 DRAGONAVR 3 3 1 0 SIMAVR 2 1 1 0 THIRDPARTYAVR 2 1 1 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/avr/blinky_arduino-uno/qk/iar/blinky-qk.ewp ================================================ 2 Debug AVR 1 General 11 9 1 1 ICCAVR 6 17 1 1 AAVR 5 11 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 1 XAR 2 0 1 1 BILINK 0 Release AVR 0 General 11 9 1 0 ICCAVR 6 17 1 0 AAVR 5 11 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 0 XAR 2 0 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c ================================================ FILE: examples/avr/blinky_arduino-uno/qk/iar/blinky-qk.eww ================================================ $WS_DIR$\blinky-qk.ewp ================================================ FILE: examples/avr/blinky_arduino-uno/qk/iar/bsp.c ================================================ /***************************************************************************** * Product: Blinky example, Arduino-UNO, preemptive QK-nano kernel, IAR-AVR * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-05-28 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* the AVR MCU variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO */ #define LED_L (1U << 5) /* ISRs used in this project ===============================================*/ #pragma vector = TIMER2_COMPA_vect __interrupt void timer2_ISR(void) { QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { DDRB = 0xFFU; // All PORTB pins are outputs (user LED) PORTB = 0x00U; // drive all pins low } /*..........................................................................*/ void BSP_ledOff(void) { PORTB &= ~LED_L; } /*..........................................................................*/ void BSP_ledOn(void) { PORTB |= LED_L; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //QF_INT_DISABLE(); //PORTB |= LED_L; //PORTB &= ~LED_L; //QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QK_CPU_SLEEP(); /* put CPU to sleep */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ } /***************************************************************************** * NOTE1: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/blinky_arduino-uno/qk/iar/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/blinky_arduino-uno/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/avr/blinky_arduino-uno/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano, Arduino-UNO, cooperative QV kernel, GNU-AVR # Last Updated for Version: 5.4.0 # Date of the Last Update: 2015-05-28 # # Q u a n t u m L e a P s # --------------------------- # innovating embedded systems # # Copyright (C) Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # Web: http://www.state-machine.com # Email: info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := blinky-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/avr/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ blinky.c \ bsp.c \ main.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := $(PROJECT).ld QP_SRCS := \ qepn.c \ qfn.c \ qvn.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # AVR MCU type AVR_MCU=atmega328p #----------------------------------------------------------------------------- # GNU-AVR toolset (NOTE: You need to adjust to your machine) # see http://sourceforge.net/projects/winavr # ifeq ($(GNU_AVR),) GNU_AVR = C:\tools\WinAVR endif # make sure that the GNU-AVR toolset exists... ifeq ("$(wildcard $(GNU_AVR))","") $(error GNU_AVR toolset not found. Please adjust the Makefile) endif CC := $(GNU_AVR)/bin/avr-gcc CPP := $(GNU_AVR)/bin/avr-g++ AS := $(GNU_AVR)/bin/avr-as LINK := $(GNU_AVR)/bin/avr-gcc BIN := $(GNU_AVR)/bin/avr-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M4F # # combine all the soruces... C_SRCS += $(QP_SRCS) $(QP_PORT) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := dbg ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS = -mmcu=$(AVR_MCU) \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_HEX := $(BIN_DIR)/$(OUTPUT).hex TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_HEX) #all: $(TARGET_ELF) $(TARGET_HEX): $(TARGET_ELF) $(BIN) -O ihex $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) -c $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.hex \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/avr/blinky_arduino-uno/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be invoked directly (via the make utility) from the QM modeling tool. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default), Release, and Spy. The various build configurations are built as follows: make make CONF=rel make CONF=spy make clean make CONF=rel clean make CONF=spy clean Warning: '__progmem__' attribute ignored ======================================== AVR is a Harvard architecture that uses different program and data spaces as well as different CPU instructions to access these two address spaces (data memory is 8-bit wide while program memory is 16-bit wide). Consequently, one of the biggest concerns in AVR programs is to correctly allocate and access constant data in the program space (ROM) rather than the precious RAM. Since the ROM resides in a different address space, you need to tell the compiler to place variables there. You also need a way to access the data (i.e., the compiler has to use the lpm instruction.) The GNU-AVR compiler supports data in the program memory only partially through the attribute((progmem)) extension (typically used through the PROGMEM macro). By tagging a variable with attribute((progmem)), you can force it to reside in the ROM. However, the compiler support ends at this point. It is the responsibility of the developer to correctly access the PROGMEM variables. The GCC-AVR provides merely a bunch of macros (all defined in the avr\pgmspace.h header file). The bottom line is that the GNU-AVR compiler support for ROM-allocated objects through the PROGMEM attribute is both incomplete and inconsistent with the correct implementation in other compilers (such as IAR-AVR). For example, pointers pointing to PROGMEM objects are not treated correctly, meaning that the compiler will not generate the right code to access such ROM objects (the GNU-AVR compiler needs a kludge in form of macros such as pgm_read_byte_near and others). To recognize that fact, the GNU-AVR generates the warnings "'progmem' attribute ignored ". However, the QP source code is written for a standard correct implementation (how else would you achieve portability?). For example, the IAR-AVR compiler uses the attribute '__flash' to designate objects and pointers to ROM objects. The compiler then generates the right code for all such flash objects and pointers, without any kludges necessary for the GNU compiler. In summary, the warnings "'progmem' attribute ignored" should be ignored in the QP library build. To avoid these warnings, the QP source code would have to be modified in such a way that it would be incorrect for other compilers that handle these declarations correctly. ================================================ FILE: examples/avr/blinky_arduino-uno/qv/gnu/bsp.c ================================================ /***************************************************************************** * Product: Blinky example, Arduino-UNO board, cooperative QV kernel, GNU-AVR * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-08 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" /* the AVR device specific header is already included */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO (PORTB) */ #define LED_L (1U << 5) /* ISRs used in this project ===============================================*/ ISR(TIMER2_COMPA_vect) { QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { DDRB = 0xFFU; // All PORTB pins are outputs (user LED) PORTB = 0x00U; // drive all pins low } /*..........................................................................*/ void BSP_ledOff(void) { PORTB &= ~LED_L; } /*..........................................................................*/ void BSP_ledOn(void) { PORTB |= LED_L; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE2 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE2: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/blinky_arduino-uno/qv/gnu/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/blinky_arduino-uno/qv/iar/blinky-qv.ewd ================================================ 2 Debug AVR 1 C-SPY 6 16 1 1 ATMELICEAVR 5 1 1 1 AVRONE 4 4 1 1 CCRAVR 2 1 1 1 ICE200AVR 2 1 1 1 JTAGICEAVR 3 2 1 1 JTAGICE3AVR 5 6 1 1 JTAGICEMKIIAVR 5 7 1 1 DRAGONAVR 3 3 1 1 SIMAVR 2 1 1 1 THIRDPARTYAVR 2 1 1 1 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release AVR 0 C-SPY 6 16 1 0 ATMELICEAVR 5 1 1 0 AVRONE 4 4 1 0 CCRAVR 2 1 1 0 ICE200AVR 2 1 1 0 JTAGICEAVR 3 2 1 0 JTAGICE3AVR 5 6 1 0 JTAGICEMKIIAVR 5 7 1 0 DRAGONAVR 3 3 1 0 SIMAVR 2 1 1 0 THIRDPARTYAVR 2 1 1 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/avr/blinky_arduino-uno/qv/iar/blinky-qv.ewp ================================================ 2 Debug AVR 1 General 11 9 1 1 ICCAVR 6 17 1 1 AAVR 5 11 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 1 XAR 2 0 1 1 BILINK 0 Release AVR 0 General 11 9 1 0 ICCAVR 6 17 1 0 AAVR 5 11 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 0 XAR 2 0 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c ================================================ FILE: examples/avr/blinky_arduino-uno/qv/iar/blinky-qv.eww ================================================ $WS_DIR$\blinky-qv.ewp ================================================ FILE: examples/avr/blinky_arduino-uno/qv/iar/bsp.c ================================================ /***************************************************************************** * Product: Blinky example for Arduino-UNO, cooperative QV kernel, IAR-AVR * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-05-28 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* the AVR MCU variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO */ #define LED_L (1U << 5) /* ISRs used in this project ===============================================*/ #pragma vector = TIMER2_COMPA_vect __interrupt void timer2_ISR(void) { QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { DDRB = 0xFFU; // All PORTB pins are outputs (user LED) PORTB = 0x00U; // drive all pins low } /*..........................................................................*/ void BSP_ledOff(void) { PORTB &= ~LED_L; } /*..........................................................................*/ void BSP_ledOn(void) { PORTB |= LED_L; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE2 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ } /***************************************************************************** * NOTE01: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE2: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/blinky_arduino-uno/qv/iar/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/dpp_arduino-uno/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/avr_dpp_arduino-uno.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/avr/dpp_arduino-uno/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/avr/dpp_arduino-uno/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/avr/dpp_arduino-uno/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(&AO_Table, DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/avr/dpp_arduino-uno/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/avr/dpp_arduino-uno/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(&AO_Table, DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/avr/dpp_arduino-uno/qk/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano, Arduino-UNO, preemptive QK kernel, GNU-AVR # Last Updated for Version: 5.4.0 # Date of the Last Update: 2015-05-28 # # Q u a n t u m L e a P s # --------------------------- # innovating embedded systems # # Copyright (C) Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # Web: http://www.state-machine.com # Email: info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qk #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/avr/qk/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qkn \ $(QP_PORT_DIR) # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := QP_SRCS := \ qepn.c \ qfn.c \ qkn.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # AVR MCU type AVR_MCU=atmega328p #----------------------------------------------------------------------------- # GNU-AVR toolset (NOTE: You need to adjust to your machine) # see http://sourceforge.net/projects/winavr # ifeq ($(GNU_AVR),) GNU_AVR = C:\tools\WinAVR endif # make sure that the GNU-AVR toolset exists... ifeq ("$(wildcard $(GNU_AVR))","") $(error GNU_AVR toolset not found. Please adjust the Makefile) endif CC := $(GNU_AVR)/bin/avr-gcc CPP := $(GNU_AVR)/bin/avr-g++ AS := $(GNU_AVR)/bin/avr-as LINK := $(GNU_AVR)/bin/avr-gcc BIN := $(GNU_AVR)/bin/avr-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M4F # # combine all the soruces... C_SRCS += $(QP_SRCS) $(QP_PORT) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := dbg ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS = -mmcu=$(AVR_MCU) \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_HEX := $(BIN_DIR)/$(OUTPUT).hex TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_HEX) #all: $(TARGET_ELF) $(TARGET_HEX): $(TARGET_ELF) $(BIN) -O ihex $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) -c $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.hex \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/avr/dpp_arduino-uno/qk/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be invoked directly (via the make utility) from the QM modeling tool. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default) and Release. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean Warning: '__progmem__' attribute ignored ======================================== AVR is a Harvard architecture that uses different program and data spaces as well as different CPU instructions to access these two address spaces (data memory is 8-bit wide while program memory is 16-bit wide). Consequently, one of the biggest concerns in AVR programs is to correctly allocate and access constant data in the program space (ROM) rather than the precious RAM. Since the ROM resides in a different address space, you need to tell the compiler to place variables there. You also need a way to access the data (i.e., the compiler has to use the lpm instruction.) The GNU-AVR compiler supports data in the program memory only partially through the attribute((progmem)) extension (typically used through the PROGMEM macro). By tagging a variable with attribute((progmem)), you can force it to reside in the ROM. However, the compiler support ends at this point. It is the responsibility of the developer to correctly access the PROGMEM variables. The GCC-AVR provides merely a bunch of macros (all defined in the avr\pgmspace.h header file). The bottom line is that the GNU-AVR compiler support for ROM-allocated objects through the PROGMEM attribute is both incomplete and inconsistent with the correct implementation in other compilers (such as IAR-AVR). For example, pointers pointing to PROGMEM objects are not treated correctly, meaning that the compiler will not generate the right code to access such ROM objects (the GNU-AVR compiler needs a kludge in form of macros such as pgm_read_byte_near and others). To recognize that fact, the GNU-AVR generates the warnings "'progmem' attribute ignored ". However, the QP source code is written for a standard correct implementation (how else would you achieve portability?). For example, the IAR-AVR compiler uses the attribute '__flash' to designate objects and pointers to ROM objects. The compiler then generates the right code for all such flash objects and pointers, without any kludges necessary for the GNU compiler. In summary, the warnings "'progmem' attribute ignored" should be ignored in the QP library build. To avoid these warnings, the QP source code would have to be modified in such a way that it would be incorrect for other compilers that handle these declarations correctly. ================================================ FILE: examples/avr/dpp_arduino-uno/qk/gnu/bsp.c ================================================ /***************************************************************************** * Product: DPP example, Arduino-UNO board, preemptive QK kernel, GNU-AVR * Last updated for version 6.8.0 * Last updated on 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" /* the AVR device specific header is already included */ /* add other drivers if necessary... */ Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO (PORTB) */ #define LED_L (1U << 5) /* external button BTN_EXT (PORTD), arduino.cc/en/tutorial/button */ #define BTN_EXT (1U << 2) static unsigned l_rnd; /* random seed */ /* ISRs used in this project ===============================================*/ ISR(TIMER2_COMPA_vect) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { 0xFFU, 0xFFU }; uint8_t current; uint8_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = PIND; /* read PORTD with the state of BTN_EXT */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* setup the port for the LED (PORTB.5) */ DDRB = 0xFFU; /* set all pins on PORTB as output */ PORTB &= ~LED_L; /* drive LED_L pin low */ /* setup the port for the Button (PORTD.2) */ DDRD &= ~BTN_EXT; /* set PORTD pin BTN_EXT as input */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { PORTB |= LED_L; } else { PORTB &= ~LED_L; } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //PORTB |= LED_L; } else { //PORTB &= ~LED_L; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //QF_INT_DISABLE(); //PORTB |= LED_L; //PORTB &= ~LED_L; //QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QK_CPU_SLEEP(); /* put CPU to sleep */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int location) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE1: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/dpp_arduino-uno/qk/gnu/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/README.txt ================================================ About The DPP-AVR Example ========================= This directory contains the DPP example for the 8-bit AVRmega processor family with the IAR-AVR compiler. *** NOTE: The Debug build configuration needs to use the high optimization level (for size) in order to fit under the code size limit of the free KickStart version of the IAR-AVR toolset. *** ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/bsp.c ================================================ /***************************************************************************** * Product: DPP example, Arduino-UNO board, preemptive QK kernel, IAR-AVR * Last updated for version 6.8.0 * Last updated on 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include /* the AVR MCU variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO (PORTB) */ #define LED_L (1U << 5) /* external button BTN_EXT (PORTD), arduino.cc/en/tutorial/button */ #define BTN_EXT (1U << 2) static unsigned l_rnd; /* random seed */ /* ISRs used in this project ===============================================*/ #pragma vector = TIMER2_COMPA_vect __interrupt void timer2_ISR(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { 0xFFU, 0xFFU }; uint8_t current; uint8_t tmp; QK_ISR_ENTRY(); /* inform QK about entering an ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = PIND; /* read PORTD with the state of BTN_EXT */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting an ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { /* setup the port for the LED (PORTB.5) */ DDRB = 0xFFU; /* set all pins on PORTB as output */ PORTB &= ~LED_L; /* drive LED_L pin low */ /* setup the port for the Button (PORTD.2) */ DDRD &= ~BTN_EXT; /* set PORTD pin BTN_EXT as input */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { PORTB |= LED_L; } else { PORTB &= ~LED_L; } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //PORTB |= LED_L; } else { //PORTB &= ~LED_L; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //QF_INT_DISABLE(); //PORTB |= LED_L; //PORTB &= ~LED_L; //QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QK_CPU_SLEEP(); /* put CPU to sleep */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int location) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE1: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/dpp-qk.ewd ================================================ 2 Debug AVR 1 C-SPY 6 16 1 1 ATMELICEAVR 5 1 1 1 AVRONE 4 4 1 1 CCRAVR 2 1 1 1 ICE200AVR 2 1 1 1 JTAGICEAVR 3 2 1 1 JTAGICE3AVR 5 6 1 1 JTAGICEMKIIAVR 5 7 1 1 DRAGONAVR 3 3 1 1 SIMAVR 2 1 1 1 THIRDPARTYAVR 2 1 1 1 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release AVR 0 C-SPY 6 16 1 0 ATMELICEAVR 5 1 1 0 AVRONE 4 4 1 0 CCRAVR 2 1 1 0 ICE200AVR 2 1 1 0 JTAGICEAVR 3 2 1 0 JTAGICE3AVR 5 6 1 0 JTAGICEMKIIAVR 5 7 1 0 DRAGONAVR 3 3 1 0 SIMAVR 2 1 1 0 THIRDPARTYAVR 2 1 1 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/dpp-qk.ewp ================================================ 2 Debug AVR 1 General 11 9 1 1 ICCAVR 6 17 1 1 AAVR 5 11 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 1 XAR 2 0 1 1 BILINK 0 Release AVR 0 General 11 9 1 0 ICCAVR 6 17 1 0 AAVR 5 11 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 0 XAR 2 0 1 0 BILINK 0 Application $PROJ_DIR$\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/dpp_arduino-uno/qk/iar/spy.bat ================================================ set COM_PORT=COM5 if [%1] NEQ [] set COM_PORT=%1 qspy -c%COM_PORT% -b115200 -O2 -F2 -E1 -P1 -B1 ================================================ FILE: examples/avr/dpp_arduino-uno/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/avr/dpp_arduino-uno/qv/gnu/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano, Arduino-UNO, cooperative QV kernel, GNU-AVR # Last Updated for Version: 5.4.0 # Date of the Last Update: 2015-05-28 # # Q u a n t u m L e a P s # --------------------------- # innovating embedded systems # # Copyright (C) Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # Web: http://www.state-machine.com # Email: info@state-machine.com ############################################################################## # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the Qtools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/Qtools/ # #----------------------------------------------------------------------------- # project name # PROJECT := dpp-qv #----------------------------------------------------------------------------- # project directories # # location of the QP-nano framework (if not provided in an environemnt var.) ifeq ($(QPN),) QPN := ../../../../.. endif # QP port used in this project QP_PORT_DIR := $(QPN)/ports/avr/qv/gnu # list of all source directories used by this project VPATH = \ .. \ ../.. \ $(QPN)/src/qfn \ $(QPN)/src/qvn \ $(QP_PORT_DIR) # list of all include directories needed by this project INCLUDES = \ -I../.. \ -I$(QPN)/include \ -I$(QP_PORT_DIR) #----------------------------------------------------------------------------- # files # # assembler source files ASM_SRCS := # C source files C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c # C++ source files CPP_SRCS := OUTPUT := $(PROJECT) LD_SCRIPT := QP_SRCS := \ qepn.c \ qfn.c \ qvn.c QP_ASMS := LIB_DIRS := LIBS := # defines DEFINES := # AVR MCU type AVR_MCU=atmega328p #----------------------------------------------------------------------------- # GNU-AVR toolset (NOTE: You need to adjust to your machine) # see http://sourceforge.net/projects/winavr # ifeq ($(GNU_AVR),) GNU_AVR = C:\tools\WinAVR endif # make sure that the GNU-AVR toolset exists... ifeq ("$(wildcard $(GNU_AVR))","") $(error GNU_AVR toolset not found. Please adjust the Makefile) endif CC := $(GNU_AVR)/bin/avr-gcc CPP := $(GNU_AVR)/bin/avr-g++ AS := $(GNU_AVR)/bin/avr-as LINK := $(GNU_AVR)/bin/avr-gcc BIN := $(GNU_AVR)/bin/avr-objcopy ############################################################################## # Typically, you should not need to change anything below this line # basic utilities (included in Qtools for Windows), see: # http://sourceforge.net/projects/qpc/files/Qtools MKDIR := mkdir RM := rm #----------------------------------------------------------------------------- # build options for various configurations for ARM Cortex-M4F # # combine all the soruces... C_SRCS += $(QP_SRCS) $(QP_PORT) ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := rel ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -Os $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := dbg ASFLAGS = CFLAGS = -mmcu=$(AVR_MCU) -std=gnu99 -fshort-enums -Wall \ -ffunction-sections -fdata-sections \ -O $(INCLUDES) $(DEFINES) CPPFLAGS = -mmcu=$(AVR_MCU) -fshort-enums -Wall \ -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions \ -O $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS = -mmcu=$(AVR_MCU) \ -Wl,-Map,$(BIN_DIR)/$(OUTPUT).map,--cref,--gc-sections $(LIB_DIRS) ASM_OBJS := $(patsubst %.s,%.o, $(notdir $(ASM_SRCS))) C_OBJS := $(patsubst %.c,%.o, $(notdir $(C_SRCS))) CPP_OBJS := $(patsubst %.cpp,%.o,$(notdir $(CPP_SRCS))) TARGET_HEX := $(BIN_DIR)/$(OUTPUT).hex TARGET_ELF := $(BIN_DIR)/$(OUTPUT).elf ASM_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(ASM_OBJS)) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o, %.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o, %.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_HEX) #all: $(TARGET_ELF) $(TARGET_HEX): $(TARGET_ELF) $(BIN) -O ihex $< $@ $(TARGET_ELF) : $(ASM_OBJS_EXT) $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.s $(AS) $(ASFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) -c $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) -c $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean clean: -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(BIN_DIR)/*.hex \ $(BIN_DIR)/*.elf \ $(BIN_DIR)/*.map show: @echo PROJECT = $(PROJECT) @echo CONF = $(CONF) @echo DEFINES = $(DEFINES) @echo ASM_FPU = $(ASM_FPU) @echo ASM_SRCS = $(ASM_SRCS) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo ASM_OBJS_EXT = $(ASM_OBJS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo TARGET_ELF = $(TARGET_ELF) ================================================ FILE: examples/avr/dpp_arduino-uno/qv/gnu/README.txt ================================================ About this Example ================== This example can be built from the command prompt with the provided Makefile. The example can also be invoked directly (via the make utility) from the QM modeling tool. The Makefile ============ The provided Makefile should be easy to adapt for your own projects. It contains three build configurations: Debug (default) and Release. The various build configurations are built as follows: make make CONF=rel make clean make CONF=rel clean Warning: '__progmem__' attribute ignored ======================================== AVR is a Harvard architecture that uses different program and data spaces as well as different CPU instructions to access these two address spaces (data memory is 8-bit wide while program memory is 16-bit wide). Consequently, one of the biggest concerns in AVR programs is to correctly allocate and access constant data in the program space (ROM) rather than the precious RAM. Since the ROM resides in a different address space, you need to tell the compiler to place variables there. You also need a way to access the data (i.e., the compiler has to use the lpm instruction.) The GNU-AVR compiler supports data in the program memory only partially through the attribute((progmem)) extension (typically used through the PROGMEM macro). By tagging a variable with attribute((progmem)), you can force it to reside in the ROM. However, the compiler support ends at this point. It is the responsibility of the developer to correctly access the PROGMEM variables. The GCC-AVR provides merely a bunch of macros (all defined in the avr\pgmspace.h header file). The bottom line is that the GNU-AVR compiler support for ROM-allocated objects through the PROGMEM attribute is both incomplete and inconsistent with the correct implementation in other compilers (such as IAR-AVR). For example, pointers pointing to PROGMEM objects are not treated correctly, meaning that the compiler will not generate the right code to access such ROM objects (the GNU-AVR compiler needs a kludge in form of macros such as pgm_read_byte_near and others). To recognize that fact, the GNU-AVR generates the warnings "'progmem' attribute ignored ". However, the QP source code is written for a standard correct implementation (how else would you achieve portability?). For example, the IAR-AVR compiler uses the attribute '__flash' to designate objects and pointers to ROM objects. The compiler then generates the right code for all such flash objects and pointers, without any kludges necessary for the GNU compiler. In summary, the warnings "'progmem' attribute ignored" should be ignored in the QP library build. To avoid these warnings, the QP source code would have to be modified in such a way that it would be incorrect for other compilers that handle these declarations correctly. ================================================ FILE: examples/avr/dpp_arduino-uno/qv/gnu/bsp.c ================================================ /***************************************************************************** * Product: DPP example, Arduino-UNO board, cooperative QV kernel, GNU-AVR * Last updated for version 6.8.0 * Last updated on 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" /* the AVR device specific header is already included */ /* add other drivers if necessary... */ Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO (PORTB) */ #define LED_L (1U << 5) /* external button BTN_EXT (PORTD), arduino.cc/en/tutorial/button */ #define BTN_EXT (1U << 2) static unsigned l_rnd; /* random seed */ /* ISRs used in this project ===============================================*/ ISR(TIMER2_COMPA_vect) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { 0xFFU, 0xFFU }; uint8_t current; uint8_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = PIND; /* read PORTD with the state of BTN_EXT */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /* BSP functions ===========================================================*/ void BSP_init(void) { /* setup the port for the LED (PORTB.5) */ DDRB = 0xFFU; /* set all pins on PORTB as output */ PORTB &= ~LED_L; /* drive LED_L pin low */ /* setup the port for the Button (PORTD.2) */ DDRD &= ~BTN_EXT; /* set PORTD pin BTN_EXT as input */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { PORTB |= LED_L; } else { PORTB &= ~LED_L; } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //PORTB |= LED_L; } else { //PORTB &= ~LED_L; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int location) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE1: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE2: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/dpp_arduino-uno/qv/gnu/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/dpp_arduino-uno/qv/gnu/spy.bat ================================================ set COM_PORT=COM5 if [%1] NEQ [] set COM_PORT=%1 qspy -c%COM_PORT% -b115200 -O2 -F2 -E1 -P1 -B1 ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/README.txt ================================================ About The DPP-AVR Example ========================= This directory contains the DPP example for the 8-bit AVRmega processor family with the IAR-AVR compiler. *** NOTE: The Debug build configuration needs to use the high optimization level (for size) in order to fit under the code size limit of the free KickStart version of the IAR-AVR toolset. *** ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/bsp.c ================================================ /***************************************************************************** * Product: DPP example, Arduino-UNO board, cooperative QV kernel, IAR-AVR * Last updated for version 6.8.0 * Last updated on 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include /* the AVR MCU variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* Arduino-UNO runs off the 16MHz oscillator */ #define F_CPU 16000000UL /* the on-board LED labeled "L" on Arduino-UNO (PORTB) */ #define LED_L (1U << 5) /* external button BTN_EXT (PORTD), arduino.cc/en/tutorial/button */ #define BTN_EXT (1U << 2) static unsigned l_rnd; /* random seed */ /* ISRs used in this project ===============================================*/ #pragma vector = TIMER2_COMPA_vect __interrupt void timer2_ISR(void) { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { 0xFFU, 0xFFU }; uint8_t current; uint8_t tmp; QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = PIND; /* read PORTD with the state of BTN_EXT */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN_EXT) != 0U) { /* debounced BTN_EXT state changed? */ if ((buttons.depressed & BTN_EXT) != 0U) { /* is BTN_EXT depressed? */ QACTIVE_POST_ISR(&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR(&AO_Table, SERVE_SIG, 0U); } } } /* BSP functions ===========================================================*/ void BSP_init(void) { /* setup the port for the LED (PORTB.5) */ DDRB = 0xFFU; /* set all pins on PORTB as output */ PORTB &= ~LED_L; /* drive LED_L pin low */ /* setup the port for the Button (PORTD.2) */ DDRD &= ~BTN_EXT; /* set PORTD pin BTN_EXT as input */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { PORTB |= LED_L; } else { PORTB &= ~LED_L; } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //PORTB |= LED_L; } else { //PORTB &= ~LED_L; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { /* set Timer2 in CTC mode, 1/1024 prescaler, start the timer ticking... */ TCCR2A = (1U << WGM21) | (0U << WGM20); TCCR2B = (1U << CS22 ) | (1U << CS21) | (1U << CS20); /* 1/2^10 */ ASSR &= ~(1U << AS2); TIMSK2 = (1U << OCIE2A); /* Enable TIMER2 compare Interrupt */ TCNT2 = 0U; OCR2A = (F_CPU / BSP_TICKS_PER_SEC / 1024U) - 1U; } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* called with interrupts DISABLED, see NOTE1 */ /* toggle the User LED, see NOTE1 , not enough LEDs to implement! */ //PORTB |= LED_L; //PORTB &= ~LED_L; #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular AVR MCU. */ SMCR = (0 << SM0) | (1 << SE); /* idle mode, adjust to your project */ QV_CPU_SLEEP(); /* atomically go to sleep and enable interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const module, int location) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ QF_RESET(); /* reset the CPU */ for (;;) { } } /***************************************************************************** * NOTE1: * The QV_onIdle() callback is called with interrupts disabled, because the * determination of the idle condition might change by any interrupt posting * an event. QV_onIdle() must internally enable interrupts, ideally * atomically with putting the CPU to the power-saving mode. * * NOTE2: * The User LED is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/dpp-qv.ewd ================================================ 2 Debug AVR 1 C-SPY 6 16 1 1 ATMELICEAVR 5 1 1 1 AVRONE 4 4 1 1 CCRAVR 2 1 1 1 ICE200AVR 2 1 1 1 JTAGICEAVR 3 2 1 1 JTAGICE3AVR 5 6 1 1 JTAGICEMKIIAVR 5 7 1 1 DRAGONAVR 3 3 1 1 SIMAVR 2 1 1 1 THIRDPARTYAVR 2 1 1 1 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release AVR 0 C-SPY 6 16 1 0 ATMELICEAVR 5 1 1 0 AVRONE 4 4 1 0 CCRAVR 2 1 1 0 ICE200AVR 2 1 1 0 JTAGICEAVR 3 2 1 0 JTAGICE3AVR 5 6 1 0 JTAGICEMKIIAVR 5 7 1 0 DRAGONAVR 3 3 1 0 SIMAVR 2 1 1 0 THIRDPARTYAVR 2 1 1 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\Stk600\Stk600Plugin.ewplugin 1 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/dpp-qv.ewp ================================================ 2 Debug AVR 1 General 11 9 1 1 ICCAVR 6 17 1 1 AAVR 5 11 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 1 XAR 2 0 1 1 BILINK 0 Release AVR 0 General 11 9 1 0 ICCAVR 6 17 1 0 AAVR 5 11 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 3 16 1 0 XAR 2 0 1 0 BILINK 0 Application $PROJ_DIR$\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/flash.bat ================================================ @echo off ::============================================================================ :: Batch file to program the flash of Arduino-UNO :: :: NOTE: requires the AVRDUDE uitlity which is included in the QTools :: collection :: setlocal @echo off @echo Load a given hex file to the flash of Arduino-UNO @echo usage: flash hex-file [COM-port] @echo example: flash dbg\blinky-qk.hex @echo example: flash dbg\blinky-qk.hex COM5 ::---------------------------------------------------------------------------- :: NOTE: Adjust the following symbol to the location of the :: AVRDUDE utility on your machine :: set AVRDUDE=avrdude.exe set COM_PORT=COM5 if [%2] NEQ [] set COM_PORT=%2 if ["%~1"]==[""] ( @echo The hex file missing @goto end ) if not exist %~s1 ( @echo The hex file '%1' does not exist @goto end ) @echo on %AVRDUDE% -p atmega328p -c arduino -P %COM_PORT% -b 115200 -D -v -U flash:w:%1:i @echo off :end endlocal ================================================ FILE: examples/avr/dpp_arduino-uno/qv/iar/spy.bat ================================================ set COM_PORT=COM5 if [%1] NEQ [] set COM_PORT=%1 qspy -c%COM_PORT% -b115200 -O2 -F2 -E1 -P1 -B1 ================================================ FILE: examples/avr/dpp_arduino-uno/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/msp430/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/exa_msp430.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/msp430_blinky_msp-exp430f5529lp.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on MSP-EXP430F5529LP, preemptive QK-nano kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-04 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 1MHz clock setting, see BSP_init() */ #define BSP_MCK 1000000U #define BSP_SMCLK 1000000U #define LED1 (1U << 0) #define LED2 (1U << 7) #define BTN_S1 (1U << 1) /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR (void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) __attribute__ ((interrupt(TIMER0_A0_VECTOR))) void TIMER0_A0_ISR (void) #else #error Compiler not supported! #endif { QK_ISR_ENTRY(); /* inform QK about entering the ISR */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* leave the MCK and SMCLK at default DCO setting */ P1DIR |= LED1; /* set LED1 pin to output */ P4DIR |= LED2; /* set LED2 pin to output */ } /*..........................................................................*/ void BSP_ledOff(void) { P1OUT &= ~LED1; /* turn LED1 off */ } /*..........................................................................*/ void BSP_ledOn(void) { P1OUT |= LED1; /* turn LED1 on */ } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TA0CCTL0 = CCIE; /* CCR0 interrupt enabled */ TA0CCR0 = BSP_MCK / BSP_TICKS_PER_SEC; TA0CTL = TASSEL_2 + MC_1 + TACLR; /* SMCLK, upmode, clear TAR */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE1 */ QF_INT_DISABLE(); P4OUT |= LED2; /* turn LED2 on */ P4OUT &= ~LED2; /* turn LED2 off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/ccs/.project ================================================ blinky-qk_msp-exp430f5529lp org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QKn 2 PARENT-5-PROJECT_LOC/src/qkn QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qk/ccs blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h main.c 1 PARENT-2-PROJECT_LOC/main.c ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/ccs/lnk_msp430f5529.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430f5529.cmd - LINKER COMMAND FILE FOR LINKING MSP430F5529 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x2400, length = 0x2000 USBRAM : origin = 0x1C00, length = 0x0800 INFOA : origin = 0x1980, length = 0x0080 INFOB : origin = 0x1900, length = 0x0080 INFOC : origin = 0x1880, length = 0x0080 INFOD : origin = 0x1800, length = 0x0080 FLASH : origin = 0x4400, length = 0xBB80 FLASH2 : origin = 0x10000,length = 0x14400 INT00 : origin = 0xFF80, length = 0x0002 INT01 : origin = 0xFF82, length = 0x0002 INT02 : origin = 0xFF84, length = 0x0002 INT03 : origin = 0xFF86, length = 0x0002 INT04 : origin = 0xFF88, length = 0x0002 INT05 : origin = 0xFF8A, length = 0x0002 INT06 : origin = 0xFF8C, length = 0x0002 INT07 : origin = 0xFF8E, length = 0x0002 INT08 : origin = 0xFF90, length = 0x0002 INT09 : origin = 0xFF92, length = 0x0002 INT10 : origin = 0xFF94, length = 0x0002 INT11 : origin = 0xFF96, length = 0x0002 INT12 : origin = 0xFF98, length = 0x0002 INT13 : origin = 0xFF9A, length = 0x0002 INT14 : origin = 0xFF9C, length = 0x0002 INT15 : origin = 0xFF9E, length = 0x0002 INT16 : origin = 0xFFA0, length = 0x0002 INT17 : origin = 0xFFA2, length = 0x0002 INT18 : origin = 0xFFA4, length = 0x0002 INT19 : origin = 0xFFA6, length = 0x0002 INT20 : origin = 0xFFA8, length = 0x0002 INT21 : origin = 0xFFAA, length = 0x0002 INT22 : origin = 0xFFAC, length = 0x0002 INT23 : origin = 0xFFAE, length = 0x0002 INT24 : origin = 0xFFB0, length = 0x0002 INT25 : origin = 0xFFB2, length = 0x0002 INT26 : origin = 0xFFB4, length = 0x0002 INT27 : origin = 0xFFB6, length = 0x0002 INT28 : origin = 0xFFB8, length = 0x0002 INT29 : origin = 0xFFBA, length = 0x0002 INT30 : origin = 0xFFBC, length = 0x0002 INT31 : origin = 0xFFBE, length = 0x0002 INT32 : origin = 0xFFC0, length = 0x0002 INT33 : origin = 0xFFC2, length = 0x0002 INT34 : origin = 0xFFC4, length = 0x0002 INT35 : origin = 0xFFC6, length = 0x0002 INT36 : origin = 0xFFC8, length = 0x0002 INT37 : origin = 0xFFCA, length = 0x0002 INT38 : origin = 0xFFCC, length = 0x0002 INT39 : origin = 0xFFCE, length = 0x0002 INT40 : origin = 0xFFD0, length = 0x0002 INT41 : origin = 0xFFD2, length = 0x0002 INT42 : origin = 0xFFD4, length = 0x0002 INT43 : origin = 0xFFD6, length = 0x0002 INT44 : origin = 0xFFD8, length = 0x0002 INT45 : origin = 0xFFDA, length = 0x0002 INT46 : origin = 0xFFDC, length = 0x0002 INT47 : origin = 0xFFDE, length = 0x0002 INT48 : origin = 0xFFE0, length = 0x0002 INT49 : origin = 0xFFE2, length = 0x0002 INT50 : origin = 0xFFE4, length = 0x0002 INT51 : origin = 0xFFE6, length = 0x0002 INT52 : origin = 0xFFE8, length = 0x0002 INT53 : origin = 0xFFEA, length = 0x0002 INT54 : origin = 0xFFEC, length = 0x0002 INT55 : origin = 0xFFEE, length = 0x0002 INT56 : origin = 0xFFF0, length = 0x0002 INT57 : origin = 0xFFF2, length = 0x0002 INT58 : origin = 0xFFF4, length = 0x0002 INT59 : origin = 0xFFF6, length = 0x0002 INT60 : origin = 0xFFF8, length = 0x0002 INT61 : origin = 0xFFFA, length = 0x0002 INT62 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ #ifndef __LARGE_DATA_MODEL__ .text : {}>> FLASH /* Code */ #else .text : {}>> FLASH2 | FLASH /* Code */ #endif .text:_isr : {} > FLASH /* ISR Code space */ .cinit : {} > FLASH /* Initialization tables */ #ifndef __LARGE_DATA_MODEL__ .const : {} > FLASH /* Constant data */ #else .const : {} > FLASH | FLASH2 /* Constant data */ #endif .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ .int00 : {} > INT00 .int01 : {} > INT01 .int02 : {} > INT02 .int03 : {} > INT03 .int04 : {} > INT04 .int05 : {} > INT05 .int06 : {} > INT06 .int07 : {} > INT07 .int08 : {} > INT08 .int09 : {} > INT09 .int10 : {} > INT10 .int11 : {} > INT11 .int12 : {} > INT12 .int13 : {} > INT13 .int14 : {} > INT14 .int15 : {} > INT15 .int16 : {} > INT16 .int17 : {} > INT17 .int18 : {} > INT18 .int19 : {} > INT19 .int20 : {} > INT20 .int21 : {} > INT21 .int22 : {} > INT22 .int23 : {} > INT23 .int24 : {} > INT24 .int25 : {} > INT25 .int26 : {} > INT26 .int27 : {} > INT27 .int28 : {} > INT28 .int29 : {} > INT29 .int30 : {} > INT30 .int31 : {} > INT31 .int32 : {} > INT32 .int33 : {} > INT33 .int34 : {} > INT34 .int35 : {} > INT35 .int36 : {} > INT36 .int37 : {} > INT37 .int38 : {} > INT38 .int39 : {} > INT39 .int40 : {} > INT40 RTC : { * ( .int41 ) } > INT41 type = VECT_INIT PORT2 : { * ( .int42 ) } > INT42 type = VECT_INIT TIMER2_A1 : { * ( .int43 ) } > INT43 type = VECT_INIT TIMER2_A0 : { * ( .int44 ) } > INT44 type = VECT_INIT USCI_B1 : { * ( .int45 ) } > INT45 type = VECT_INIT USCI_A1 : { * ( .int46 ) } > INT46 type = VECT_INIT PORT1 : { * ( .int47 ) } > INT47 type = VECT_INIT TIMER1_A1 : { * ( .int48 ) } > INT48 type = VECT_INIT TIMER1_A0 : { * ( .int49 ) } > INT49 type = VECT_INIT DMA : { * ( .int50 ) } > INT50 type = VECT_INIT USB_UBM : { * ( .int51 ) } > INT51 type = VECT_INIT TIMER0_A1 : { * ( .int52 ) } > INT52 type = VECT_INIT TIMER0_A0 : { * ( .int53 ) } > INT53 type = VECT_INIT ADC12 : { * ( .int54 ) } > INT54 type = VECT_INIT USCI_B0 : { * ( .int55 ) } > INT55 type = VECT_INIT USCI_A0 : { * ( .int56 ) } > INT56 type = VECT_INIT WDT : { * ( .int57 ) } > INT57 type = VECT_INIT TIMER0_B1 : { * ( .int58 ) } > INT58 type = VECT_INIT TIMER0_B0 : { * ( .int59 ) } > INT59 type = VECT_INIT COMP_B : { * ( .int60 ) } > INT60 type = VECT_INIT UNMI : { * ( .int61 ) } > INT61 type = VECT_INIT SYSNMI : { * ( .int62 ) } > INT62 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430f5529.cmd ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/iar/blinky-qk.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/iar/blinky-qk.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qk/iar/blinky-qk.eww ================================================ $WS_DIR$\blinky-qk.ewp ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on MSP-EXP430F5529LP, cooperative QV-nano kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-04 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 1MHz clock setting, see BSP_init() */ #define BSP_MCK 1000000U #define BSP_SMCLK 1000000U #define LED1 (1U << 0) #define LED2 (1U << 7) #define BTN_S1 (1U << 1) /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR (void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) __attribute__ ((interrupt(TIMER0_A0_VECTOR))) void TIMER0_A0_ISR (void) #else #error Compiler not supported! #endif { #ifdef NDEBUG __low_power_mode_off_on_exit(); /* see NOTE1 */ #endif QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* leave the MCK and SMCLK at default DCO setting */ P1DIR |= LED1; /* set LED1 pin to output */ P4DIR |= LED2; /* set LED2 pin to output */ } /*..........................................................................*/ void BSP_ledOff(void) { P1OUT &= ~LED1; /* turn LED1 off */ } /*..........................................................................*/ void BSP_ledOn(void) { P1OUT |= LED1; /* turn LED1 on */ } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TA0CCTL0 = CCIE; /* CCR0 interrupt enabled */ TA0CCR0 = BSP_MCK / BSP_TICKS_PER_SEC; TA0CTL = TASSEL_2 + MC_1 + TACLR; /* SMCLK, upmode, clear TAR */ } /*..........................................................................*/ void QV_onIdle(void) { /* NOTE: called with interrutps DISABLED, see NOTE1 */ /* toggle LED2 on and then off, see NOTE2 */ P4OUT |= LED2; /* turn LED2 on */ P4OUT &= ~LED2; /* turn LED2 off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * With the cooperative QV kernel for MSP430, it is necessary to explicitly * turn the low-power mode OFF in the interrupt, because the return * from the interrupt will restore the CPU status register, which will * re-enter the low-power mode. This, in turn, will prevent the QV event-loop * from running. * * NOTE2: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/ccs/.project ================================================ blinky-qv_msp-exp430f5529lp org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qv/ccs QVn 2 PARENT-5-PROJECT_LOC/src/qvn blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h main.c 1 PARENT-2-PROJECT_LOC/main.c ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/ccs/lnk_msp430f5529.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430f5529.cmd - LINKER COMMAND FILE FOR LINKING MSP430F5529 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x2400, length = 0x2000 USBRAM : origin = 0x1C00, length = 0x0800 INFOA : origin = 0x1980, length = 0x0080 INFOB : origin = 0x1900, length = 0x0080 INFOC : origin = 0x1880, length = 0x0080 INFOD : origin = 0x1800, length = 0x0080 FLASH : origin = 0x4400, length = 0xBB80 FLASH2 : origin = 0x10000,length = 0x14400 INT00 : origin = 0xFF80, length = 0x0002 INT01 : origin = 0xFF82, length = 0x0002 INT02 : origin = 0xFF84, length = 0x0002 INT03 : origin = 0xFF86, length = 0x0002 INT04 : origin = 0xFF88, length = 0x0002 INT05 : origin = 0xFF8A, length = 0x0002 INT06 : origin = 0xFF8C, length = 0x0002 INT07 : origin = 0xFF8E, length = 0x0002 INT08 : origin = 0xFF90, length = 0x0002 INT09 : origin = 0xFF92, length = 0x0002 INT10 : origin = 0xFF94, length = 0x0002 INT11 : origin = 0xFF96, length = 0x0002 INT12 : origin = 0xFF98, length = 0x0002 INT13 : origin = 0xFF9A, length = 0x0002 INT14 : origin = 0xFF9C, length = 0x0002 INT15 : origin = 0xFF9E, length = 0x0002 INT16 : origin = 0xFFA0, length = 0x0002 INT17 : origin = 0xFFA2, length = 0x0002 INT18 : origin = 0xFFA4, length = 0x0002 INT19 : origin = 0xFFA6, length = 0x0002 INT20 : origin = 0xFFA8, length = 0x0002 INT21 : origin = 0xFFAA, length = 0x0002 INT22 : origin = 0xFFAC, length = 0x0002 INT23 : origin = 0xFFAE, length = 0x0002 INT24 : origin = 0xFFB0, length = 0x0002 INT25 : origin = 0xFFB2, length = 0x0002 INT26 : origin = 0xFFB4, length = 0x0002 INT27 : origin = 0xFFB6, length = 0x0002 INT28 : origin = 0xFFB8, length = 0x0002 INT29 : origin = 0xFFBA, length = 0x0002 INT30 : origin = 0xFFBC, length = 0x0002 INT31 : origin = 0xFFBE, length = 0x0002 INT32 : origin = 0xFFC0, length = 0x0002 INT33 : origin = 0xFFC2, length = 0x0002 INT34 : origin = 0xFFC4, length = 0x0002 INT35 : origin = 0xFFC6, length = 0x0002 INT36 : origin = 0xFFC8, length = 0x0002 INT37 : origin = 0xFFCA, length = 0x0002 INT38 : origin = 0xFFCC, length = 0x0002 INT39 : origin = 0xFFCE, length = 0x0002 INT40 : origin = 0xFFD0, length = 0x0002 INT41 : origin = 0xFFD2, length = 0x0002 INT42 : origin = 0xFFD4, length = 0x0002 INT43 : origin = 0xFFD6, length = 0x0002 INT44 : origin = 0xFFD8, length = 0x0002 INT45 : origin = 0xFFDA, length = 0x0002 INT46 : origin = 0xFFDC, length = 0x0002 INT47 : origin = 0xFFDE, length = 0x0002 INT48 : origin = 0xFFE0, length = 0x0002 INT49 : origin = 0xFFE2, length = 0x0002 INT50 : origin = 0xFFE4, length = 0x0002 INT51 : origin = 0xFFE6, length = 0x0002 INT52 : origin = 0xFFE8, length = 0x0002 INT53 : origin = 0xFFEA, length = 0x0002 INT54 : origin = 0xFFEC, length = 0x0002 INT55 : origin = 0xFFEE, length = 0x0002 INT56 : origin = 0xFFF0, length = 0x0002 INT57 : origin = 0xFFF2, length = 0x0002 INT58 : origin = 0xFFF4, length = 0x0002 INT59 : origin = 0xFFF6, length = 0x0002 INT60 : origin = 0xFFF8, length = 0x0002 INT61 : origin = 0xFFFA, length = 0x0002 INT62 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ #ifndef __LARGE_DATA_MODEL__ .text : {}>> FLASH /* Code */ #else .text : {}>> FLASH2 | FLASH /* Code */ #endif .text:_isr : {} > FLASH /* ISR Code space */ .cinit : {} > FLASH /* Initialization tables */ #ifndef __LARGE_DATA_MODEL__ .const : {} > FLASH /* Constant data */ #else .const : {} > FLASH | FLASH2 /* Constant data */ #endif .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ .int00 : {} > INT00 .int01 : {} > INT01 .int02 : {} > INT02 .int03 : {} > INT03 .int04 : {} > INT04 .int05 : {} > INT05 .int06 : {} > INT06 .int07 : {} > INT07 .int08 : {} > INT08 .int09 : {} > INT09 .int10 : {} > INT10 .int11 : {} > INT11 .int12 : {} > INT12 .int13 : {} > INT13 .int14 : {} > INT14 .int15 : {} > INT15 .int16 : {} > INT16 .int17 : {} > INT17 .int18 : {} > INT18 .int19 : {} > INT19 .int20 : {} > INT20 .int21 : {} > INT21 .int22 : {} > INT22 .int23 : {} > INT23 .int24 : {} > INT24 .int25 : {} > INT25 .int26 : {} > INT26 .int27 : {} > INT27 .int28 : {} > INT28 .int29 : {} > INT29 .int30 : {} > INT30 .int31 : {} > INT31 .int32 : {} > INT32 .int33 : {} > INT33 .int34 : {} > INT34 .int35 : {} > INT35 .int36 : {} > INT36 .int37 : {} > INT37 .int38 : {} > INT38 .int39 : {} > INT39 .int40 : {} > INT40 RTC : { * ( .int41 ) } > INT41 type = VECT_INIT PORT2 : { * ( .int42 ) } > INT42 type = VECT_INIT TIMER2_A1 : { * ( .int43 ) } > INT43 type = VECT_INIT TIMER2_A0 : { * ( .int44 ) } > INT44 type = VECT_INIT USCI_B1 : { * ( .int45 ) } > INT45 type = VECT_INIT USCI_A1 : { * ( .int46 ) } > INT46 type = VECT_INIT PORT1 : { * ( .int47 ) } > INT47 type = VECT_INIT TIMER1_A1 : { * ( .int48 ) } > INT48 type = VECT_INIT TIMER1_A0 : { * ( .int49 ) } > INT49 type = VECT_INIT DMA : { * ( .int50 ) } > INT50 type = VECT_INIT USB_UBM : { * ( .int51 ) } > INT51 type = VECT_INIT TIMER0_A1 : { * ( .int52 ) } > INT52 type = VECT_INIT TIMER0_A0 : { * ( .int53 ) } > INT53 type = VECT_INIT ADC12 : { * ( .int54 ) } > INT54 type = VECT_INIT USCI_B0 : { * ( .int55 ) } > INT55 type = VECT_INIT USCI_A0 : { * ( .int56 ) } > INT56 type = VECT_INIT WDT : { * ( .int57 ) } > INT57 type = VECT_INIT TIMER0_B1 : { * ( .int58 ) } > INT58 type = VECT_INIT TIMER0_B0 : { * ( .int59 ) } > INT59 type = VECT_INIT COMP_B : { * ( .int60 ) } > INT60 type = VECT_INIT UNMI : { * ( .int61 ) } > INT61 type = VECT_INIT SYSNMI : { * ( .int62 ) } > INT62 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430f5529.cmd ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/iar/blinky-qv.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/iar/blinky-qv.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c ================================================ FILE: examples/msp430/blinky_msp-exp430f5529lp/qv/iar/blinky-qv.eww ================================================ $WS_DIR$\blinky-qv.ewp ================================================ FILE: examples/msp430/blinky_msp-exp430g2/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/msp430_blinky_msp-exp430g2.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/msp430/blinky_msp-exp430g2/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/msp430/blinky_msp-exp430g2/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/bsp.c ================================================ /***************************************************************************** * Product: "Blinky" on MSP-EXP430G2, preemptive QK-nano kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-05-28 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 1MHz clock setting, see BSP_init() */ #define BSP_MCK 1000000U #define BSP_SMCLK 1000000U #define LED1 (1U << 0) #define LED2 (1U << 6) /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR(void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void) #else #error Compiler not supported! #endif { QK_ISR_ENTRY(); /* inform QK about entering the ISR */ TACTL &= ~TAIFG; /* clear the interrupt pending flag */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* configure the Basic Clock Module */ DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; P1DIR |= (LED1 | LED2); /* set LED1 and LED2 pins to output */ } /*..........................................................................*/ void BSP_ledOff(void) { P1OUT &= ~LED1; /* turn LED1 off */ } /*..........................................................................*/ void BSP_ledOn(void) { P1OUT |= LED1; /* turn LED1 on */ } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TACTL = (ID_3 | TASSEL_2 | MC_1); /* SMCLK, /8 divider, upmode */ TACCR0 = (((BSP_SMCLK / 8U) + BSP_TICKS_PER_SEC/2U) / BSP_TICKS_PER_SEC); CCTL0 = CCIE; /* CCR0 interrupt enabled */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE1 */ QF_INT_DISABLE(); P1OUT |= LED2; /* turn LED2 on */ P1OUT &= ~LED2; /* turn LED2 off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/ccs/.project ================================================ blinky-qk_msp-exp430g2 org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QKn 2 PARENT-5-PROJECT_LOC/src/qkn QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qk/ccs blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h main.c 1 PARENT-2-PROJECT_LOC/main.c ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/ccs/lnk_msp430g2553.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430g2553.cmd - LINKER COMMAND FILE FOR LINKING MSP430G2553 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x0200, length = 0x0200 INFOA : origin = 0x10C0, length = 0x0040 INFOB : origin = 0x1080, length = 0x0040 INFOC : origin = 0x1040, length = 0x0040 INFOD : origin = 0x1000, length = 0x0040 FLASH : origin = 0xC000, length = 0x3FE0 INT00 : origin = 0xFFE0, length = 0x0002 INT01 : origin = 0xFFE2, length = 0x0002 INT02 : origin = 0xFFE4, length = 0x0002 INT03 : origin = 0xFFE6, length = 0x0002 INT04 : origin = 0xFFE8, length = 0x0002 INT05 : origin = 0xFFEA, length = 0x0002 INT06 : origin = 0xFFEC, length = 0x0002 INT07 : origin = 0xFFEE, length = 0x0002 INT08 : origin = 0xFFF0, length = 0x0002 INT09 : origin = 0xFFF2, length = 0x0002 INT10 : origin = 0xFFF4, length = 0x0002 INT11 : origin = 0xFFF6, length = 0x0002 INT12 : origin = 0xFFF8, length = 0x0002 INT13 : origin = 0xFFFA, length = 0x0002 INT14 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ .text : {} > FLASH /* Code */ .cinit : {} > FLASH /* Initialization tables */ .const : {} > FLASH /* Constant data */ .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ TRAPINT : { * ( .int00 ) } > INT00 type = VECT_INIT .int01 : {} > INT01 PORT1 : { * ( .int02 ) } > INT02 type = VECT_INIT PORT2 : { * ( .int03 ) } > INT03 type = VECT_INIT .int04 : {} > INT04 ADC10 : { * ( .int05 ) } > INT05 type = VECT_INIT USCIAB0TX : { * ( .int06 ) } > INT06 type = VECT_INIT USCIAB0RX : { * ( .int07 ) } > INT07 type = VECT_INIT TIMER0_A1 : { * ( .int08 ) } > INT08 type = VECT_INIT TIMER0_A0 : { * ( .int09 ) } > INT09 type = VECT_INIT WDT : { * ( .int10 ) } > INT10 type = VECT_INIT COMPARATORA : { * ( .int11 ) } > INT11 type = VECT_INIT TIMER1_A1 : { * ( .int12 ) } > INT12 type = VECT_INIT TIMER1_A0 : { * ( .int13 ) } > INT13 type = VECT_INIT NMI : { * ( .int14 ) } > INT14 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430g2553.cmd ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/iar/blinky-qk.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/iar/blinky-qk.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qk/iar/blinky-qk.eww ================================================ $WS_DIR$\blinky-qk.ewp ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/bsp.c ================================================ /***************************************************************************** * Product: Blinky on MSP-EXP430G2, cooperative QV kernel * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-05-28 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 1MHz clock setting, see BSP_init() */ #define BSP_MCK 1000000U #define BSP_SMCLK 1000000U #define LED1 (1U << 0) #define LED2 (1U << 6) /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR(void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR (void) #else #error Compiler not supported! #endif { TACTL &= ~TAIFG; /* clear the interrupt pending flag */ #ifdef NDEBUG __low_power_mode_off_on_exit(); /* see NOTE1 */ #endif QF_tickXISR(0U); /* process time events for rate 0 */ } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* configure the Basic Clock Module */ DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; P1DIR |= (LED1 | LED2); /* set LED1 and LED2 pins to output */ } /*..........................................................................*/ void BSP_ledOff(void) { P1OUT &= ~LED1; /* turn LED1 off */ } /*..........................................................................*/ void BSP_ledOn(void) { P1OUT |= LED1; /* turn LED1 on */ } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TACTL = (ID_3 | TASSEL_2 | MC_1); /* SMCLK, /8 divider, upmode */ TACCR0 = (((BSP_SMCLK / 8U) + BSP_TICKS_PER_SEC/2U) / BSP_TICKS_PER_SEC); CCTL0 = CCIE; /* CCR0 interrupt enabled */ } /*..........................................................................*/ void QV_onIdle(void) { /* NOTE: called with interrutps DISABLED, see NOTE1 */ /* toggle LED2 on and then off, see NOTE2 */ P1OUT |= LED2; /* turn LED2 on */ P1OUT &= ~LED2; /* turn LED2 off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * With the cooperative QV kernel for MSP430, it is necessary to explicitly * turn the low-power mode OFF in the interrupt, because the return * from the interrupt will restore the CPU status register, which will * re-enter the low-power mode. This, in turn, will prevent the QV event-loop * from running. * * NOTE2: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/ccs/.project ================================================ blinky-qv_msp-exp430g2 org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qv/ccs QVn 2 PARENT-5-PROJECT_LOC/src/qvn blinky.c 1 PARENT-2-PROJECT_LOC/blinky.c blinky.h 1 PARENT-2-PROJECT_LOC/blinky.h bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h main.c 1 PARENT-2-PROJECT_LOC/main.c ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/ccs/lnk_msp430g2553.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430g2553.cmd - LINKER COMMAND FILE FOR LINKING MSP430G2553 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x0200, length = 0x0200 INFOA : origin = 0x10C0, length = 0x0040 INFOB : origin = 0x1080, length = 0x0040 INFOC : origin = 0x1040, length = 0x0040 INFOD : origin = 0x1000, length = 0x0040 FLASH : origin = 0xC000, length = 0x3FE0 INT00 : origin = 0xFFE0, length = 0x0002 INT01 : origin = 0xFFE2, length = 0x0002 INT02 : origin = 0xFFE4, length = 0x0002 INT03 : origin = 0xFFE6, length = 0x0002 INT04 : origin = 0xFFE8, length = 0x0002 INT05 : origin = 0xFFEA, length = 0x0002 INT06 : origin = 0xFFEC, length = 0x0002 INT07 : origin = 0xFFEE, length = 0x0002 INT08 : origin = 0xFFF0, length = 0x0002 INT09 : origin = 0xFFF2, length = 0x0002 INT10 : origin = 0xFFF4, length = 0x0002 INT11 : origin = 0xFFF6, length = 0x0002 INT12 : origin = 0xFFF8, length = 0x0002 INT13 : origin = 0xFFFA, length = 0x0002 INT14 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ .text : {} > FLASH /* Code */ .cinit : {} > FLASH /* Initialization tables */ .const : {} > FLASH /* Constant data */ .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ TRAPINT : { * ( .int00 ) } > INT00 type = VECT_INIT .int01 : {} > INT01 PORT1 : { * ( .int02 ) } > INT02 type = VECT_INIT PORT2 : { * ( .int03 ) } > INT03 type = VECT_INIT .int04 : {} > INT04 ADC10 : { * ( .int05 ) } > INT05 type = VECT_INIT USCIAB0TX : { * ( .int06 ) } > INT06 type = VECT_INIT USCIAB0RX : { * ( .int07 ) } > INT07 type = VECT_INIT TIMER0_A1 : { * ( .int08 ) } > INT08 type = VECT_INIT TIMER0_A0 : { * ( .int09 ) } > INT09 type = VECT_INIT WDT : { * ( .int10 ) } > INT10 type = VECT_INIT COMPARATORA : { * ( .int11 ) } > INT11 type = VECT_INIT TIMER1_A1 : { * ( .int12 ) } > INT12 type = VECT_INIT TIMER1_A0 : { * ( .int13 ) } > INT13 type = VECT_INIT NMI : { * ( .int14 ) } > INT14 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430g2553.cmd ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/iar/blinky-qv.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/iar/blinky-qv.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\..\blinky.c $PROJ_DIR$\..\..\blinky.h $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\main.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c ================================================ FILE: examples/msp430/blinky_msp-exp430g2/qv/iar/blinky-qv.eww ================================================ $WS_DIR$\blinky-qv.ewp ================================================ FILE: examples/msp430/dpp_msp-exp430g2/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/msp430_dpp_msp-exp430g2.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: examples/msp430/dpp_msp-exp430g2/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/msp430/dpp_msp-exp430g2/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/msp430/dpp_msp-exp430g2/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/bsp.c ================================================ /***************************************************************************** * Product: DPP on MSP-EXP430G2 board, preemptive QK-nano kernel * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 8MHz clock setting, see BSP_init() */ #define BSP_MCK 8000000U #define BSP_SMCLK 8000000U /* LEDs on the MSP-EXP430G2 board */ #define LED1 (1U << 0) #define LED2 (1U << 6) /* Buttons on the MSP-EXP430G2 board */ #define BTN1 (1U << 3) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR(void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR(void) #else #error MSP430 compiler not supported! #endif { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { (uint8_t)~0U, (uint8_t)~0U }; uint8_t current; uint8_t tmp; QK_ISR_ENTRY(); /* inform QK about entering the ISR */ TACTL &= ~TAIFG; /* clear the interrupt pending flag */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~P1IN; /* read P1 port with the state of BTN1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN1) != 0U) { /* debounced BTN1 state changed? */ if ((buttons.depressed & BTN1) != 0U) { /* is BTN1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); } } QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* configure the Basic Clock Module */ DCOCTL = 0; /* Select lowest DCOx and MODx settings */ BCSCTL1 = CALBC1_8MHZ; /* Set DCO */ DCOCTL = CALDCO_8MHZ; /* configure pins for LEDs */ P1DIR |= (LED1 | LED2); /* set LED1 and LED2 pins to output */ /* configure pin for Button */ P1DIR &= ~BTN1; /* set BTN1 pin as input */ P1OUT |= BTN1; /* drive output to hi */ P1REN |= BTN1; /* enable internal pull up register */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { /* is Philo hungry? */ P1OUT |= LED1; /* turn LED1 on */ } else { P1OUT &= ~LED1; /* turn LED1 off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //P1OUT |= LED1; } else { //P1OUT &= ~LED1; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * ((uint32_t)3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TACTL = (ID_3 | TASSEL_2 | MC_1); /* SMCLK, /8 divider, upmode */ TACCR0 = (((BSP_SMCLK / 8U) + BSP_TICKS_PER_SEC/2U) / BSP_TICKS_PER_SEC); CCTL0 = CCIE; /* CCR0 interrupt enabled */ } /*..........................................................................*/ void QK_onIdle(void) { /* toggle LED2 on and then off, see NOTE1 */ QF_INT_DISABLE(); P1OUT |= LED2; /* turn LED2 on */ P1OUT &= ~LED2; /* turn LED2 off */ QF_INT_ENABLE(); #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/ccs/.project ================================================ dpp-qk_msp-exp430g2 org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QKn 2 PARENT-5-PROJECT_LOC/src/qkn QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qk/ccs bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h main.c 1 PARENT-2-PROJECT_LOC/main.c philo.c 1 PARENT-2-PROJECT_LOC/philo.c table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/ccs/lnk_msp430g2553.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430g2553.cmd - LINKER COMMAND FILE FOR LINKING MSP430G2553 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x0200, length = 0x0200 INFOA : origin = 0x10C0, length = 0x0040 INFOB : origin = 0x1080, length = 0x0040 INFOC : origin = 0x1040, length = 0x0040 INFOD : origin = 0x1000, length = 0x0040 FLASH : origin = 0xC000, length = 0x3FE0 INT00 : origin = 0xFFE0, length = 0x0002 INT01 : origin = 0xFFE2, length = 0x0002 INT02 : origin = 0xFFE4, length = 0x0002 INT03 : origin = 0xFFE6, length = 0x0002 INT04 : origin = 0xFFE8, length = 0x0002 INT05 : origin = 0xFFEA, length = 0x0002 INT06 : origin = 0xFFEC, length = 0x0002 INT07 : origin = 0xFFEE, length = 0x0002 INT08 : origin = 0xFFF0, length = 0x0002 INT09 : origin = 0xFFF2, length = 0x0002 INT10 : origin = 0xFFF4, length = 0x0002 INT11 : origin = 0xFFF6, length = 0x0002 INT12 : origin = 0xFFF8, length = 0x0002 INT13 : origin = 0xFFFA, length = 0x0002 INT14 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ .text : {} > FLASH /* Code */ .cinit : {} > FLASH /* Initialization tables */ .const : {} > FLASH /* Constant data */ .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ TRAPINT : { * ( .int00 ) } > INT00 type = VECT_INIT .int01 : {} > INT01 PORT1 : { * ( .int02 ) } > INT02 type = VECT_INIT PORT2 : { * ( .int03 ) } > INT03 type = VECT_INIT .int04 : {} > INT04 ADC10 : { * ( .int05 ) } > INT05 type = VECT_INIT USCIAB0TX : { * ( .int06 ) } > INT06 type = VECT_INIT USCIAB0RX : { * ( .int07 ) } > INT07 type = VECT_INIT TIMER0_A1 : { * ( .int08 ) } > INT08 type = VECT_INIT TIMER0_A0 : { * ( .int09 ) } > INT09 type = VECT_INIT WDT : { * ( .int10 ) } > INT10 type = VECT_INIT COMPARATORA : { * ( .int11 ) } > INT11 type = VECT_INIT TIMER1_A1 : { * ( .int12 ) } > INT12 type = VECT_INIT TIMER1_A0 : { * ( .int13 ) } > INT13 type = VECT_INIT NMI : { * ( .int14 ) } > INT14 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430g2553.cmd ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/iar/dpp-qk.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/iar/dpp-qk.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qkn\qkn.c ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qk/iar/dpp-qk.eww ================================================ $WS_DIR$\dpp-qk.ewp ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/bsp.c ================================================ /***************************************************************************** * Product: DPP on MSP-EXP430G2 board, cooperative QV-nano kernel * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include /* MSP430 variant used */ /* add other drivers if necessary... */ //Q_DEFINE_THIS_FILE /* Local-scope objects -----------------------------------------------------*/ /* 8MHz clock setting, see BSP_init() */ #define BSP_MCK 8000000U #define BSP_SMCLK 8000000U /* LEDs on the MSP-EXP430G2 board */ #define LED1 (1U << 0) #define LED2 (1U << 6) /* Buttons on the MSP-EXP430G2 board */ #define BTN1 (1U << 3) /* random seed */ static uint32_t l_rnd; /* ISRs used in this project ===============================================*/ #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) __interrupt void TIMER0_A0_ISR(void); /* prototype */ #pragma vector=TIMER0_A0_VECTOR __interrupt void TIMER0_A0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(TIMER0_A0_VECTOR))) TIMER0_A0_ISR(void) #else #error MSP430 compiler not supported! #endif { /* state of the button debouncing, see below */ static struct ButtonsDebouncing { uint8_t depressed; uint8_t previous; } buttons = { (uint8_t)~0U, (uint8_t)~0U }; uint8_t current; uint8_t tmp; #ifdef NDEBUG __low_power_mode_off_on_exit(); /* see NOTE1 */ #endif TACTL &= ~TAIFG; /* clear the interrupt pending flag */ QF_tickXISR(0U); /* process time events for rate 0 */ /* Perform the debouncing of buttons. The algorithm for debouncing * adapted from the book "Embedded Systems Dictionary" by Jack Ganssle * and Michael Barr, page 71. */ current = ~P1IN; /* read P1 port with the state of BTN1 */ tmp = buttons.depressed; /* save the debounced depressed buttons */ buttons.depressed |= (buttons.previous & current); /* set depressed */ buttons.depressed &= (buttons.previous | current); /* clear released */ buttons.previous = current; /* update the history */ tmp ^= buttons.depressed; /* changed debounced depressed */ if ((tmp & BTN1) != 0U) { /* debounced BTN1 state changed? */ if ((buttons.depressed & BTN1) != 0U) { /* is BTN1 depressed? */ QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); } else { /* the button is released */ QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); } } } /* BSP functions ===========================================================*/ void BSP_init(void) { WDTCTL = WDTPW | WDTHOLD; /* stop watchdog timer */ /* configure the Basic Clock Module */ DCOCTL = 0; /* Select lowest DCOx and MODx settings */ BCSCTL1 = CALBC1_8MHZ; /* Set DCO */ DCOCTL = CALDCO_8MHZ; /* configure pins for LEDs */ P1DIR |= (LED1 | LED2); /* set LED1 and LED2 pins to output */ /* configure pin for Button */ P1DIR &= ~BTN1; /* set BTN1 pin as input */ P1OUT |= BTN1; /* drive output to hi */ P1REN |= BTN1; /* enable internal pull up register */ } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const *stat) { if (stat[0] == 'h') { /* is Philo hungry? */ P1OUT |= LED1; /* turn LED1 on */ } else { P1OUT &= ~LED1; /* turn LED1 off */ } } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { /* not enouhg LEDs to implement this feature */ if (paused != 0U) { //P1OUT |= LED1; } else { //P1OUT &= ~LED1; } } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * ((uint32_t)3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /* QF callbacks ============================================================*/ void QF_onStartup(void) { TACTL = (ID_3 | TASSEL_2 | MC_1); /* SMCLK, /8 divider, upmode */ TACCR0 = (((BSP_SMCLK / 8U) + BSP_TICKS_PER_SEC/2U) / BSP_TICKS_PER_SEC); CCTL0 = CCIE; /* CCR0 interrupt enabled */ } /*..........................................................................*/ void QV_onIdle(void) { /* NOTE: called with interrutps DISABLED, see NOTE1 */ /* toggle LED2 on and then off, see NOTE1 */ P1OUT |= LED2; /* turn LED2 on */ P1OUT &= ~LED2; /* turn LED2 off */ #ifdef NDEBUG /* Put the CPU and peripherals to the low-power mode. * you might need to customize the clock management for your application, * see the datasheet for your particular MSP430 MCU. */ __low_power_mode_1(); /* Enter LPM1; also ENABLES interrupts */ #else QF_INT_ENABLE(); /* just enable interrupts */ #endif } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { /* implement the error-handling policy for your application!!! */ QF_INT_DISABLE(); /* disable all interrupts */ /* cause the reset of the CPU... */ WDTCTL = WDTPW | WDTHOLD; __asm(" push &0xFFFE"); /* return from function does the reset */ } /***************************************************************************** * NOTE1: * One of the LEDs is used to visualize the idle loop activity. The brightness * of the LED is proportional to the frequency of invcations of the idle loop. * Please note that the LED is toggled with interrupts locked, so no interrupt * execution time contributes to the brightness of the User LED. */ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/ccs/.ccsproject ================================================ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/ccs/.cproject ================================================ ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/ccs/.project ================================================ dpp-qv_msp-exp430g2 org.eclipse.cdt.managedbuilder.core.genmakebuilder org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder full,incremental, com.ti.ccstudio.core.ccsNature org.eclipse.cdt.core.cnature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature QP 2 PARENT-5-PROJECT_LOC/src/qfn QP_port 2 PARENT-5-PROJECT_LOC/ports/msp430/qv/ccs QVn 2 PARENT-5-PROJECT_LOC/src/qvn bsp.c 1 PARENT-1-PROJECT_LOC/bsp.c bsp.h 1 PARENT-2-PROJECT_LOC/bsp.h dpp.h 1 PARENT-2-PROJECT_LOC/dpp.h main.c 1 PARENT-2-PROJECT_LOC/main.c philo.c 1 PARENT-2-PROJECT_LOC/philo.c table.c 1 PARENT-2-PROJECT_LOC/table.c ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/ccs/lnk_msp430g2553.cmd ================================================ /* ============================================================================ */ /* Copyright (c) 2014, Texas Instruments Incorporated */ /* All rights reserved. */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* * Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* * Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* */ /* * Neither the name of Texas Instruments Incorporated nor the names of */ /* its contributors may be used to endorse or promote products derived */ /* from this software without specific prior written permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" */ /* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, */ /* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ============================================================================ */ /******************************************************************************/ /* lnk_msp430g2553.cmd - LINKER COMMAND FILE FOR LINKING MSP430G2553 PROGRAMS */ /* */ /* Usage: lnk430 -o -m lnk.cmd */ /* cl430 -z -o -m lnk.cmd */ /* */ /*----------------------------------------------------------------------------*/ /* These linker options are for command line linking only. For IDE linking, */ /* you should set your linker options in Project Properties */ /* -c LINK USING C CONVENTIONS */ /* -stack 0x0100 SOFTWARE STACK SIZE */ /* -heap 0x0100 HEAP AREA SIZE */ /* */ /*----------------------------------------------------------------------------*/ /* Version: 1.159 */ /*----------------------------------------------------------------------------*/ /****************************************************************************/ /* Specify the system memory map */ /****************************************************************************/ MEMORY { SFR : origin = 0x0000, length = 0x0010 PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0 PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100 RAM : origin = 0x0200, length = 0x0200 INFOA : origin = 0x10C0, length = 0x0040 INFOB : origin = 0x1080, length = 0x0040 INFOC : origin = 0x1040, length = 0x0040 INFOD : origin = 0x1000, length = 0x0040 FLASH : origin = 0xC000, length = 0x3FE0 INT00 : origin = 0xFFE0, length = 0x0002 INT01 : origin = 0xFFE2, length = 0x0002 INT02 : origin = 0xFFE4, length = 0x0002 INT03 : origin = 0xFFE6, length = 0x0002 INT04 : origin = 0xFFE8, length = 0x0002 INT05 : origin = 0xFFEA, length = 0x0002 INT06 : origin = 0xFFEC, length = 0x0002 INT07 : origin = 0xFFEE, length = 0x0002 INT08 : origin = 0xFFF0, length = 0x0002 INT09 : origin = 0xFFF2, length = 0x0002 INT10 : origin = 0xFFF4, length = 0x0002 INT11 : origin = 0xFFF6, length = 0x0002 INT12 : origin = 0xFFF8, length = 0x0002 INT13 : origin = 0xFFFA, length = 0x0002 INT14 : origin = 0xFFFC, length = 0x0002 RESET : origin = 0xFFFE, length = 0x0002 } /****************************************************************************/ /* Specify the sections allocation into memory */ /****************************************************************************/ SECTIONS { .bss : {} > RAM /* Global & static vars */ .data : {} > RAM /* Global & static vars */ .TI.noinit : {} > RAM /* For #pragma noinit */ .sysmem : {} > RAM /* Dynamic memory allocation area */ .stack : {} > RAM (HIGH) /* Software system stack */ .text : {} > FLASH /* Code */ .cinit : {} > FLASH /* Initialization tables */ .const : {} > FLASH /* Constant data */ .cio : {} > RAM /* C I/O Buffer */ .pinit : {} > FLASH /* C++ Constructor tables */ .init_array : {} > FLASH /* C++ Constructor tables */ .mspabi.exidx : {} > FLASH /* C++ Constructor tables */ .mspabi.extab : {} > FLASH /* C++ Constructor tables */ .infoA : {} > INFOA /* MSP430 INFO FLASH Memory segments */ .infoB : {} > INFOB .infoC : {} > INFOC .infoD : {} > INFOD /* MSP430 Interrupt vectors */ TRAPINT : { * ( .int00 ) } > INT00 type = VECT_INIT .int01 : {} > INT01 PORT1 : { * ( .int02 ) } > INT02 type = VECT_INIT PORT2 : { * ( .int03 ) } > INT03 type = VECT_INIT .int04 : {} > INT04 ADC10 : { * ( .int05 ) } > INT05 type = VECT_INIT USCIAB0TX : { * ( .int06 ) } > INT06 type = VECT_INIT USCIAB0RX : { * ( .int07 ) } > INT07 type = VECT_INIT TIMER0_A1 : { * ( .int08 ) } > INT08 type = VECT_INIT TIMER0_A0 : { * ( .int09 ) } > INT09 type = VECT_INIT WDT : { * ( .int10 ) } > INT10 type = VECT_INIT COMPARATORA : { * ( .int11 ) } > INT11 type = VECT_INIT TIMER1_A1 : { * ( .int12 ) } > INT12 type = VECT_INIT TIMER1_A0 : { * ( .int13 ) } > INT13 type = VECT_INIT NMI : { * ( .int14 ) } > INT14 type = VECT_INIT .reset : {} > RESET /* MSP430 Reset vector */ } /****************************************************************************/ /* Include peripherals memory map */ /****************************************************************************/ -l msp430g2553.cmd ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/iar/dpp-qv.ewd ================================================ 2 Debug MSP430 1 C-SPY 5 27 1 1 430FET 1 29 1 1 SIM430 1 4 1 1 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 Release MSP430 0 C-SPY 5 27 1 0 430FET 1 29 1 0 SIM430 1 4 1 0 $TOOLKIT_DIR$\plugins\lcd\lcd.ewplugin 1 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyPlugin.ENU.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin 0 $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin 0 $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin 1 $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin 1 $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/iar/dpp-qv.ewp ================================================ 2 Debug MSP430 1 General 17 33 1 1 ICC430 4 37 1 1 A430 5 14 1 1 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 1 XAR 4 0 1 1 ULP430 1 1 1 1 BILINK 0 Release MSP430 0 General 17 33 1 0 ICC430 4 37 1 0 A430 5 14 1 0 CUSTOM 3 0 BICOMP 0 BUILDACTION 1 XLINK 4 29 1 0 XAR 4 0 1 0 ULP430 1 1 1 0 BILINK 0 Application $PROJ_DIR$\..\bsp.c $PROJ_DIR$\..\..\bsp.h $PROJ_DIR$\..\..\dpp.h $PROJ_DIR$\..\..\main.c $PROJ_DIR$\..\..\philo.c $PROJ_DIR$\..\..\table.c QP $PROJ_DIR$\..\..\..\..\..\src\qfn\qepn.c $PROJ_DIR$\..\..\..\..\..\src\qfn\qfn.c $PROJ_DIR$\..\..\..\..\..\src\qvn\qvn.c ================================================ FILE: examples/msp430/dpp_msp-exp430g2/qv/iar/dpp-qv.eww ================================================ $WS_DIR$\dpp-qv.ewp ================================================ FILE: examples/msp430/dpp_msp-exp430g2/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/blinky.c ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "blinky.h" #include "bsp.h" //Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct BlinkyTag { /* the Blinky active object */ QActive super; /* inherit QActive */ } Blinky; /* hierarchical state machine ... */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off (Blinky * const me); static QState Blinky_on (Blinky * const me); /* Global objects ----------------------------------------------------------*/ Blinky AO_Blinky; /* the single instance of the Blinky AO */ /*..........................................................................*/ void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Blinky_initial(Blinky * const me) { QActive_armX((QActive *)me, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*..........................................................................*/ QState Blinky_off(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOff(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_on); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Blinky_on(Blinky * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { BSP_ledOn(); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&Blinky_off); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/blinky.h ================================================ /***************************************************************************** * Product: simple "Blinky" example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BLINKY_H #define BLINKY_H enum BlinkySignals { DUMMY_SIG = Q_USER_SIG, MAX_PUB_SIG, /* the last published signal */ TIMEOUT_SIG, MAX_SIG /* the last signal */ }; void Blinky_ctor(void); extern struct BlinkyTag AO_Blinky; #endif /* BLINKY_H */ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/bsp.h ================================================ /***************************************************************************** * Product: Simple Blinky example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_ledOff(void); void BSP_ledOn(void); #endif /* BSP_H */ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/main.c ================================================ /***************************************************************************** * Product: "Blinky" example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "blinky.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /*..........................................................................*/ int main(void) { Blinky_ctor(); /* instantiate all Blinky AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/bsp.c ================================================ /***************************************************************************** * BSP for Blinky example, Microstick II board, preemptive QK-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "blinky.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ QK_ISR(no_auto_psv) _T2Interrupt() { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*..........................................................................*/ QK_ISR(auto_psv) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Blinky, TIMEOUT_SIG, 0U); QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_ledOff(void) { LED_OFF(); } /*..........................................................................*/ void BSP_ledOn(void) { LED_ON(); } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG Idle(); /* transition to Idle mode */ #endif } ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/blinky.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 15:29:01 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=18f6378f44eecca920a9a2899c83284a com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/pelican.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../main.c ../../qpn_conf.h ../../blinky.c ../../blinky.h Makefile ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/private/private.xml ================================================ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qk/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject blinky-microstick2-pic24-qkn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn default 2 release 2 false ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the PELICAN example * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 2U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/bsp.c ================================================ /***************************************************************************** * BSP for Blinky example, Microstick II board, cooperative QV-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "blinky.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ void __attribute__((__interrupt__, auto_psv)) _T2Interrupt(void) { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ } /*..........................................................................*/ void __attribute__((__interrupt__, auto_psv)) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Blinky, TIMEOUT_SIG, 0U); } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_ledOff(void) { LED_OFF(); } /*..........................................................................*/ void BSP_ledOn(void) { LED_ON(); } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* entered with interrupts DISABLED, see NOTE01 */ /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG __asm__ volatile("disi #0x0001"); Idle(); /* transition to Idle mode, see NOTE02 */ #else QF_INT_ENABLE(); /* enable interrupts, see NOTE01 */ #endif } /***************************************************************************** * NOTE01: * The callback function QV_onIdle() is called with interrupts disabled, * because the idle condition can be invalidated by any enabled interrupt * that would post events. The QV_onIdle() function *must* re-enable * interrupts internally * * NOTE02: * To be on the safe side, the DISICNT counter is set to just 1 cycle just * before entering the Idle mode (or Sleep mode, if you choose). This way, * interrupts (with priorities 1-6) get enabled at the same time as the * transition to the low-power mode. */ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161169/qvn.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/blinky.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 15:32:42 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=49b35d6d1545e095d0a0b6a16391d697 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161169/qvn.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/blinky.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/blinky.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../blinky.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/blinky.o: ../../blinky.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o.d @${RM} ${OBJECTDIR}/_ext/43898991/blinky.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../blinky.c -o ${OBJECTDIR}/_ext/43898991/blinky.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/blinky.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/blinky.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../main.c ../../qpn_conf.h ../../blinky.c ../../blinky.h Makefile ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/private/private.xml ================================================ file:/C:/qp_lab/qpn/ports/pic24_dspic/qk/xc16/qkn_port.c ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/blinky_microstick2-pic24/qv/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject blinky-microstick2-pic24-qvn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn default 2 release 2 false ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/bsp.c ================================================ /***************************************************************************** * BSP for DPP example, Microstick II board, preemptive QK-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "dpp.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ static uint32_t l_rnd; /* random seed */ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ QK_ISR(no_auto_psv) _T2Interrupt() { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*..........................................................................*/ QK_ISR(auto_psv) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Table, EAT_SIG, 0U); QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const Q_ROM *stat) { (void)n; (void)stat; LED_TOGGLE(); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { (void)paused; } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG Idle(); /* transition to Idle mode */ #endif } ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/philo.o.d ${OBJECTDIR}/_ext/43898991/table.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 14:37:41 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=b99e8759d94c37cc57ad977d8b264629 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/philo.o.d ${OBJECTDIR}/_ext/43898991/table.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../dpp.h ../../main.c ../../philo.c ../../table.c Makefile ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/private/private.xml ================================================ file:/C:/qp_lab/qpn/ports/pic24_dspic/qk/xc16/qkn_port.c ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qk/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject dpp-microstick2-pic24-qkn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn default 2 release 2 false ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the DPP example * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 2U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/bsp.c ================================================ /***************************************************************************** * BSP for DPP example, Microstick II board, cooperative QV-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "dpp.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ static uint32_t l_rnd; /* random seed */ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ void __attribute__((__interrupt__, auto_psv)) _T2Interrupt(void) { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ } /*..........................................................................*/ void __attribute__((__interrupt__, auto_psv)) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Table, EAT_SIG, 0U); } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char const Q_ROM *stat) { (void)n; (void)stat; LED_TOGGLE(); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { (void)paused; } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* entered with interrupts DISABLED, see NOTE01 */ /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG __asm__ volatile("disi #0x0001"); Idle(); /* transition to Idle mode, see NOTE02 */ #else QF_INT_ENABLE(); /* enable interrupts, see NOTE01 */ #endif } /***************************************************************************** * NOTE01: * The callback function QV_onIdle() is called with interrupts disabled, * because the idle condition can be invalidated by any enabled interrupt * that would post events. The QV_onIdle() function *must* re-enable * interrupts internally * * NOTE02: * To be on the safe side, the DISICNT counter is set to just 1 cycle just * before entering the Idle mode (or Sleep mode, if you choose). This way, * interrupts (with priorities 1-6) get enabled at the same time as the * transition to the low-power mode. */ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c ../../../../../src/qvn/qvn.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o ${OBJECTDIR}/_ext/329161169/qvn.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/philo.o.d ${OBJECTDIR}/_ext/43898991/table.o.d ${OBJECTDIR}/_ext/329161169/qvn.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o ${OBJECTDIR}/_ext/329161169/qvn.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c ../../../../../src/qvn/qvn.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 14:58:10 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=7dfda082572eb9e8bde104809c615514 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/philo.o.d ${OBJECTDIR}/_ext/43898991/table.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/philo.o ${OBJECTDIR}/_ext/43898991/table.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../philo.c ../../table.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/philo.o: ../../philo.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/philo.o.d @${RM} ${OBJECTDIR}/_ext/43898991/philo.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../philo.c -o ${OBJECTDIR}/_ext/43898991/philo.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/philo.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/philo.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/table.o: ../../table.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/table.o.d @${RM} ${OBJECTDIR}/_ext/43898991/table.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../table.c -o ${OBJECTDIR}/_ext/43898991/table.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/table.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/table.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../dpp.h ../../main.c ../../philo.c ../../table.c Makefile ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/private/private.xml ================================================ file:/C:/qp_lab/qpn/examples/pic24_dspic/dpp_microstick2-pic24.X/qk/xc16/bsp.c file:/C:/qp_lab/qpn/src/qvn/qvn.c ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/qv/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject dpp-microstick2-pic24-qvn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn default 2 release 2 false ================================================ FILE: examples/pic24_dspic/dpp_microstick2-pic24/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/bsp.h ================================================ /***************************************************************************** * Product: BSP for PELICAN crossing example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U enum BSP_CarsSignal { CARS_RED, CARS_YELLOW, CARS_GREEN, CARS_BLANK }; enum BSP_PedsSignal { PEDS_DONT_WALK, PEDS_WALK, PEDS_BLANK }; void BSP_init(void); void BSP_showState(char_t const *state); void BSP_signalCars(enum BSP_CarsSignal sig); void BSP_signalPeds(enum BSP_PedsSignal sig); #endif /* BSP_H */ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/main.c ================================================ /***************************************************************************** * Product: PELICAN crossing example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*..........................................................................*/ static QEvt l_pelicanQueue[3]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Pelican, l_pelicanQueue, Q_DIM(l_pelicanQueue) } }; /*..........................................................................*/ int main (void) { Pelican_ctor(); /* instantiate the Pelican AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/pelican.c ================================================ /*.$file${.::pelican.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ /*.$declare${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ typedef struct Pelican { /* protected: */ QActive super; /* private: */ uint8_t flashCtr; } Pelican; /* protected: */ static QState Pelican_initial(Pelican * const me); static QState Pelican_operational(Pelican * const me); static QState Pelican_carsEnabled(Pelican * const me); static QState Pelican_carsGreen(Pelican * const me); static QState Pelican_carsGreenNoPed(Pelican * const me); static QState Pelican_carsGreenInt(Pelican * const me); static QState Pelican_carsGreenPedWait(Pelican * const me); static QState Pelican_carsYellow(Pelican * const me); static QState Pelican_pedsEnabled(Pelican * const me); static QState Pelican_pedsWalk(Pelican * const me); static QState Pelican_pedsFlash(Pelican * const me); static QState Pelican_offline(Pelican * const me); /*.$enddecl${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void) { QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); } /*.$enddef${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ /*.${components::Pelican::SM} ..............................................*/ static QState Pelican_initial(Pelican * const me) { /*.${components::Pelican::SM::initial} */ return Q_TRAN(&Pelican_operational); } /*.${components::Pelican::SM::operational} .................................*/ static QState Pelican_operational(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsEnabled); break; } /*.${components::Pelican::SM::operational::OFF} */ case OFF_SIG: { status_ = Q_TRAN(&Pelican_offline); break; } /*.${components::Pelican::SM::operational::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled} ....................*/ static QState Pelican_carsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled} */ case Q_EXIT_SIG: { BSP_signalCars(CARS_RED); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreen); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} .........*/ static QState Pelican_carsGreen(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenNoPed); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ static QState Pelican_carsGreenNoPed(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenNoPed"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsGreenPedWait); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenInt); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ static QState Pelican_carsGreenInt(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenInt"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ static QState Pelican_carsGreenPedWait(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenPedWait"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} ........*/ static QState Pelican_carsYellow(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_ENTRY_SIG: { BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsEnabled); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled} ....................*/ static QState Pelican_pedsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled} */ case Q_EXIT_SIG: { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_pedsWalk); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} ..........*/ static QState Pelican_pedsWalk(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_ENTRY_SIG: { BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsFlash); break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} .........*/ static QState Pelican_pedsFlash(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_ENTRY_SIG: { BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0U]} */ if (me->flashCtr != 0U) { --me->flashCtr; /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[else]} */ else { BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[else]} */ else { status_ = Q_TRAN(&Pelican_carsEnabled); } break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::offline} .....................................*/ static QState Pelican_offline(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::offline} */ case Q_ENTRY_SIG: { BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { me->flashCtr ^= 1U; /*.${components::Pelican::SM::offline::Q_TIMEOUT::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::offline::Q_TIMEOUT::[else]} */ else { BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } break; } /*.${components::Pelican::SM::offline::ON} */ case ON_SIG: { status_ = Q_TRAN(&Pelican_operational); break; } /*.${components::Pelican::SM::offline::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/pelican.h ================================================ /*.$file${.::pelican.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ /*.$declare${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void); /*.$enddecl${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/pelican.qm ================================================ PEdestrian LIght CONtrolled (PELICAN) crossing example PEdestrian LIght CONtrolled (PELICAN) crossing BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); QF_stop(); BSP_signalCars(CARS_RED); BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("carsGreenNoPed"); BSP_showState("carsGreenInt"); BSP_showState("carsGreenPedWait"); BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_signalPeds(PEDS_DONT_WALK); BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; QActive_disarmX(&me->super, 0U); me->flashCtr != 0U --me->flashCtr; (me->flashCtr & 1U) == 0U BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalPeds(PEDS_BLANK); else BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; QActive_disarmX(&me->super, 0U); me->flashCtr ^= 1U; (me->flashCtr & 1U) == 0U BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); QF_stop(); constructor QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ $declare(components::Pelican_ctor) extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ $declare(components::Pelican) /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ $define(components::Pelican_ctor) $define(components::Pelican) ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/bsp.c ================================================ /***************************************************************************** * BSP for PELICAN example, Microstick II board, preemptive QK-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "pelican.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ QK_ISR(no_auto_psv) _T2Interrupt() { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*..........................................................................*/ QK_ISR(auto_psv) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U); QK_ISR_EXIT(); /* inform QK about exiting the ISR */ } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_showState(char_t const *state) { (void)state; } /*..........................................................................*/ void BSP_signalCars(enum BSP_CarsSignal sig) { switch (sig) { case CARS_RED: { // break; } case CARS_YELLOW: { // break; } case CARS_GREEN: { // break; } case CARS_BLANK: { // break; } } } /*..........................................................................*/ void BSP_signalPeds(enum BSP_PedsSignal sig) { switch (sig) { case PEDS_DONT_WALK: { LED_OFF(); break; } case PEDS_BLANK: { LED_OFF(); break; } case PEDS_WALK: { LED_ON(); break; } } } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QK_onIdle(void) { /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG Idle(); /* transition to Idle mode */ #endif } ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/pelican.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 15:08:46 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=8ae3294aed6b1feb320d4ce8fb105d0f com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161510/qkn.o.d ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/pelican.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161510/qkn.o ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161510/qkn.o: ../../../../../src/qkn/qkn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161510" @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o.d @${RM} ${OBJECTDIR}/_ext/329161510/qkn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qkn/qkn.c -o ${OBJECTDIR}/_ext/329161510/qkn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161510/qkn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161510/qkn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/1875001806/qkn_port.o: ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/1875001806" @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o.d @${RM} ${OBJECTDIR}/_ext/1875001806/qkn_port.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c -o ${OBJECTDIR}/_ext/1875001806/qkn_port.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/1875001806/qkn_port.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qk/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qkn/qkn.c ../../../../../ports/pic24_dspic/qk/xc16/qkn_port.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../main.c ../../pelican.c ../../pelican.h ../../qpn_conf.h Makefile ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/private/private.xml ================================================ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qk/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject pelican-microstick2-pic24-qkn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../.. ../../../../../include ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn default 2 release 2 false ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the PELICAN example * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 2U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/Makefile ================================================ # # There exist several targets which are by default empty and which can be # used for execution of your targets. These targets are usually executed # before and after some main targets. They are: # # .build-pre: called before 'build' target # .build-post: called after 'build' target # .clean-pre: called before 'clean' target # .clean-post: called after 'clean' target # .clobber-pre: called before 'clobber' target # .clobber-post: called after 'clobber' target # .all-pre: called before 'all' target # .all-post: called after 'all' target # .help-pre: called before 'help' target # .help-post: called after 'help' target # # Targets beginning with '.' are not intended to be called on their own. # # Main targets can be executed directly, and they are: # # build build a specific configuration # clean remove built files from a configuration # clobber remove all built files # all build all configurations # help print help mesage # # Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and # .help-impl are implemented in nbproject/makefile-impl.mk. # # Available make variables: # # CND_BASEDIR base directory for relative paths # CND_DISTDIR default top distribution directory (build artifacts) # CND_BUILDDIR default top build directory (object files, ...) # CONF name of current configuration # CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration) # CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration) # CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration) # CND_PACKAGE_DIR_${CONF} directory of package (current configuration) # CND_PACKAGE_NAME_${CONF} name of package (current configuration) # CND_PACKAGE_PATH_${CONF} path to package (current configuration) # # NOCDDL # Environment MKDIR=mkdir CP=cp CCADMIN=CCadmin RANLIB=ranlib # build build: .build-post .build-pre: # Add your pre 'build' code here... .build-post: .build-impl # Add your post 'build' code here... # clean clean: .clean-post .clean-pre: # Add your pre 'clean' code here... .clean-post: .clean-impl # Add your post 'clean' code here... # clobber clobber: .clobber-post .clobber-pre: # Add your pre 'clobber' code here... .clobber-post: .clobber-impl # Add your post 'clobber' code here... # all all: .all-post .all-pre: # Add your pre 'all' code here... .all-post: .all-impl # Add your post 'all' code here... # help help: .help-post .help-pre: # Add your pre 'help' code here... .help-post: .help-impl # Add your post 'help' code here... # include project implementation makefile include nbproject/Makefile-impl.mk # include project make variables include nbproject/Makefile-variables.mk ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/bsp.c ================================================ /***************************************************************************** * BSP for DPP example, Microstick II board, cooperative QV-nano kernel * Last updated for version 6.5.1 * Last updated on 2019-06-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "pelican.h" #include "p24FJ64GB002.h" /* header for PIC24F device in use */ Q_DEFINE_THIS_FILE /* configure Fast RC Oscillator (FRC) */ #pragma config FNOSC=FRC /* Local-scope objects -----------------------------------------------------*/ /* frequency of the FRC oscillator ~ 8 MHz */ #define FOSC_HZ 8000000.0 /* instruction cycle clock frequency */ #define FCY_HZ (FOSC_HZ / 2.0) /* system clock tick period in CPU clocks / TMR2 prescaler */ #define BSP_TMR2_PERIOD ((uint16_t)(FCY_HZ / BSP_TICKS_PER_SEC)) /* controlling the LED of Microstick II */ #define LED_ON() (LATA |= (1U << 0)) #define LED_OFF() (LATA &= ~(1U << 0)) #define LED_TOGGLE() (LATA ^= (1U << 0)) /* ISRs --------------------------------------------------------------------*/ void __attribute__((__interrupt__, auto_psv)) _T2Interrupt(void) { _T2IF = 0; /* clear Timer 2 interrupt flag */ QF_tickXISR(0U); /* process time events for rate 0 */ } /*..........................................................................*/ void __attribute__((__interrupt__, auto_psv)) _INT0Interrupt() { _INT0IF = 0; QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U); } /*--------------------------------------------------------------------------*/ void BSP_init(void) { RCONbits.SWDTEN = 0; /* disable Watchdog */ TRISA = 0x00; /* set LED pins as outputs */ PORTA = 0x00; /* set LED drive state low */ } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; } /*..........................................................................*/ void BSP_showState(char_t const *state) { (void)state; } /*..........................................................................*/ void BSP_signalCars(enum BSP_CarsSignal sig) { switch (sig) { case CARS_RED: { // break; } case CARS_YELLOW: { // break; } case CARS_GREEN: { // break; } case CARS_BLANK: { // break; } } } /*..........................................................................*/ void BSP_signalPeds(enum BSP_PedsSignal sig) { switch (sig) { case PEDS_DONT_WALK: { LED_OFF(); break; } case PEDS_BLANK: { LED_OFF(); break; } case PEDS_WALK: { LED_ON(); break; } } } /*..........................................................................*/ Q_NORETURN Q_onAssert(char const Q_ROM * const file, int line) { (void)file; /* unused parameter */ (void)line; /* unused parameter */ QF_INT_DISABLE(); /* make sure that interrupts are disabled */ for (;;) { } } /*..........................................................................*/ void QF_onStartup(void) { /* entered with interrupts locked */ T2CON = 0x0000U; /* Use Internal Osc (Fcy), 16 bit mode, prescaler = 1 */ TMR2 = 0x0000U; /* Start counting from 0 and clear the prescaler count */ PR2 = (uint16_t)(BSP_TMR2_PERIOD - 1U); /* Timer2 period */ _T2IF = 0; /* clear the interrupt for Timer 2 */ _T2IE = 1; /* enable interrupt for Timer 2 */ T2CONbits.TON = 1; /* start Timer 2 */ INTCON2bits.INT0EP = 0; /* INT0 interrupt on positive edge */ _INT0IF = 0; /* clear the interrupt for INT0 */ _INT0IE = 1; /* enable INT0 interrupt */ /* explicitly assign priorities to all interrutps... */ _T2IP = 4; /* Timer 2 interrupt priority (kernel aware) */ _INT0IP = 6; /* INT0 interrupt priority (kernel aware) */ } /*..........................................................................*/ void QF_onCleanup(void) { } /*..........................................................................*/ void QF_stop(void) { } /*..........................................................................*/ void QV_onIdle(void) { /* entered with interrupts DISABLED, see NOTE01 */ /* NOTE: not enough LEDs on the Microstick II board to implement * the idle loop activity indicator ... */ //LED_ON (); /* blink the IDLE LED, see NOTE01 */ //LED_OFF(); #ifdef NDEBUG __asm__ volatile("disi #0x0001"); Idle(); /* transition to Idle mode, see NOTE02 */ #else QF_INT_ENABLE(); /* enable interrupts, see NOTE01 */ #endif } /***************************************************************************** * NOTE01: * The callback function QV_onIdle() is called with interrupts disabled, * because the idle condition can be invalidated by any enabled interrupt * that would post events. The QV_onIdle() function *must* re-enable * interrupts internally * * NOTE02: * To be on the safe side, the DISICNT counter is set to just 1 cycle just * before entering the Idle mode (or Sleep mode, if you choose). This way, * interrupts (with priorities 1-6) get enabled at the same time as the * transition to the low-power mode. */ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-default.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk" include nbproject/Makefile-local-default.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=default ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161169/qvn.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/pelican.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -O0 -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/default ${RM} -r dist/default # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-genesis.properties ================================================ # #Tue Jun 11 15:22:09 EDT 2019 default.languagetoolchain.version=1.36 release.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin default.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd conf.ids=default,release default.languagetoolchain.dir=C\:\\tools\\Microchip\\xc16\\bin configurations-xml=b0b683cb7c9301b3d6361b53b8dfea72 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=37eccb08230908d044ad3fe14e24ea9a release.com-microchip-mplab-nbide-toolchainXC16-XC16LanguageToolchain.md5=a53e8c22b31e6f5bcc1968d7c72d01dd release.languagetoolchain.version=1.36 host.platform=windows ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-impl.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a pre- and a post- target defined where you can add customization code. # # This makefile implements macros and targets common to all configurations. # # NOCDDL # Building and Cleaning subprojects are done by default, but can be controlled with the SUB # macro. If SUB=no, subprojects will not be built or cleaned. The following macro # statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf # and .clean-reqprojects-conf unless SUB has the value 'no' SUB_no=NO SUBPROJECTS=${SUB_${SUB}} BUILD_SUBPROJECTS_=.build-subprojects BUILD_SUBPROJECTS_NO= BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}} CLEAN_SUBPROJECTS_=.clean-subprojects CLEAN_SUBPROJECTS_NO= CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}} # Project Name PROJECTNAME=xc16 # Active Configuration DEFAULTCONF=default CONF=${DEFAULTCONF} # All Configurations ALLCONFS=default release # build .build-impl: .build-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf # clean .clean-impl: .clean-pre ${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf # clobber .clobber-impl: .clobber-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release clean # all .all-impl: .all-pre .depcheck-impl ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build ${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=release build # dependency checking support .depcheck-impl: # @echo "# This code depends on make tool being used" >.dep.inc # @if [ -n "${MAKE_VERSION}" ]; then \ # echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \ # echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \ # echo "include \$${DEPFILES}" >>.dep.inc; \ # echo "endif" >>.dep.inc; \ # else \ # echo ".KEEP_STATE:" >>.dep.inc; \ # echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \ # fi ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-local-default.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-local-release.mk ================================================ # # Generated Makefile - do not edit! # # # This file contains information about the location of compilers and other tools. # If you commmit this file into your revision control server, you will be able to # to checkout the project and build it from the command line with make. However, # if more than one person works on the same project, then this file might show # conflicts since different users are bound to have compilers in different places. # In that case you might choose to not commit this file and let MPLAB X recreate this file # for each user. The disadvantage of not commiting this file is that you must run MPLAB X at # least once so the file gets created and the project can be built. Finally, you can also # avoid using this file at all if you are only building from the command line with make. # You can invoke make with the values of the macros: # $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ... # SHELL=cmd.exe PATH_TO_IDE_BIN=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/ # Adding MPLAB X bin directory to path. PATH:=C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH) # Path to java used to run MPLAB X when this makefile was created MP_JAVA_PATH="C:\tools\Microchip\MPLABX\sys\java\jre1.8.0_181/bin/" OS_CURRENT="$(shell uname -s)" MP_CC="C:\tools\Microchip\xc16\bin\xc16-gcc.exe" # MP_CPPC is not defined # MP_BC is not defined MP_AS="C:\tools\Microchip\xc16\bin\xc16-as.exe" MP_LD="C:\tools\Microchip\xc16\bin\xc16-ld.exe" MP_AR="C:\tools\Microchip\xc16\bin\xc16-ar.exe" DEP_GEN=${MP_JAVA_PATH}java -jar "C:/tools/Microchip/MPLABX/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar" MP_CC_DIR="C:\tools\Microchip\xc16\bin" # MP_CPPC_DIR is not defined # MP_BC_DIR is not defined MP_AS_DIR="C:\tools\Microchip\xc16\bin" MP_LD_DIR="C:\tools\Microchip\xc16\bin" MP_AR_DIR="C:\tools\Microchip\xc16\bin" # MP_BC_DIR is not defined ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-release.mk ================================================ # # Generated Makefile - do not edit! # # Edit the Makefile in the project folder instead (../Makefile). Each target # has a -pre and a -post target defined where you can add customized code. # # This makefile implements configuration specific macros and targets. # Include project Makefile ifeq "${IGNORE_LOCAL}" "TRUE" # do not include local makefile. User is passing all local related variables already else include Makefile # Include makefile containing local settings ifeq "$(wildcard nbproject/Makefile-local-release.mk)" "nbproject/Makefile-local-release.mk" include nbproject/Makefile-local-release.mk endif endif # Environment MKDIR=gnumkdir -p RM=rm -f MV=mv CP=cp # Macros CND_CONF=release ifeq ($(TYPE_IMAGE), DEBUG_RUN) IMAGE_TYPE=debug OUTPUT_SUFFIX=elf DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} else IMAGE_TYPE=production OUTPUT_SUFFIX=hex DEBUGGABLE_SUFFIX=elf FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} endif ifeq ($(COMPARE_BUILD), true) COMPARISON_BUILD=-mafrlcsj else COMPARISON_BUILD= endif ifdef SUB_IMAGE_ADDRESS SUB_IMAGE_ADDRESS_COMMAND=--image-address $(SUB_IMAGE_ADDRESS) else SUB_IMAGE_ADDRESS_COMMAND= endif # Object Directory OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE} # Distribution Directory DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE} # Source Files Quoted if spaced SOURCEFILES_QUOTED_IF_SPACED=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c # Object Files Quoted if spaced OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o POSSIBLE_DEPFILES=${OBJECTDIR}/_ext/329161665/qepn.o.d ${OBJECTDIR}/_ext/329161665/qfn.o.d ${OBJECTDIR}/_ext/329161169/qvn.o.d ${OBJECTDIR}/bsp.o.d ${OBJECTDIR}/_ext/726959463/qstamp.o.d ${OBJECTDIR}/_ext/43898991/main.o.d ${OBJECTDIR}/_ext/43898991/pelican.o.d # Object Files OBJECTFILES=${OBJECTDIR}/_ext/329161665/qepn.o ${OBJECTDIR}/_ext/329161665/qfn.o ${OBJECTDIR}/_ext/329161169/qvn.o ${OBJECTDIR}/bsp.o ${OBJECTDIR}/_ext/726959463/qstamp.o ${OBJECTDIR}/_ext/43898991/main.o ${OBJECTDIR}/_ext/43898991/pelican.o # Source Files SOURCEFILES=../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../main.c ../../pelican.c CFLAGS= ASFLAGS= LDLIBSOPTIONS= ############# Tool locations ########################################## # If you copy a project from one host to another, the path where the # # compiler is installed may be different. # # If you open this project with MPLAB X in the new host, this # # makefile will be regenerated and the paths will be corrected. # ####################################################################### # fixDeps replaces a bunch of sed/cat/printf statements that slow down the build FIXDEPS=fixDeps .build-conf: ${BUILD_SUBPROJECTS} ifneq ($(INFORMATION_MESSAGE), ) @echo $(INFORMATION_MESSAGE) endif ${MAKE} -f nbproject/Makefile-release.mk dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} MP_PROCESSOR_OPTION=24FJ64GB002 MP_LINKER_FILE_OPTION=,--script=p24FJ64GB002.gld # ------------------------------------------------------------------------------------ # Rules for buildStep: compile ifeq ($(TYPE_IMAGE), DEBUG_RUN) ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -g -D__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ else ${OBJECTDIR}/_ext/329161665/qepn.o: ../../../../../src/qfn/qepn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qepn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qepn.c -o ${OBJECTDIR}/_ext/329161665/qepn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qepn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qepn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161665/qfn.o: ../../../../../src/qfn/qfn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161665" @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o.d @${RM} ${OBJECTDIR}/_ext/329161665/qfn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qfn/qfn.c -o ${OBJECTDIR}/_ext/329161665/qfn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161665/qfn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161665/qfn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/329161169/qvn.o: ../../../../../src/qvn/qvn.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/329161169" @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o.d @${RM} ${OBJECTDIR}/_ext/329161169/qvn.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../src/qvn/qvn.c -o ${OBJECTDIR}/_ext/329161169/qvn.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/329161169/qvn.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/329161169/qvn.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/bsp.o: bsp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}" @${RM} ${OBJECTDIR}/bsp.o.d @${RM} ${OBJECTDIR}/bsp.o ${MP_CC} $(MP_EXTRA_CC_PRE) bsp.c -o ${OBJECTDIR}/bsp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/bsp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/bsp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/726959463/qstamp.o: ../../../../../include/qstamp.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/726959463" @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o.d @${RM} ${OBJECTDIR}/_ext/726959463/qstamp.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../../../../include/qstamp.c -o ${OBJECTDIR}/_ext/726959463/qstamp.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/726959463/qstamp.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/726959463/qstamp.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/main.o: ../../main.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/main.o.d @${RM} ${OBJECTDIR}/_ext/43898991/main.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../main.c -o ${OBJECTDIR}/_ext/43898991/main.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/main.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/main.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ ${OBJECTDIR}/_ext/43898991/pelican.o: ../../pelican.c nbproject/Makefile-${CND_CONF}.mk @${MKDIR} "${OBJECTDIR}/_ext/43898991" @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o.d @${RM} ${OBJECTDIR}/_ext/43898991/pelican.o ${MP_CC} $(MP_EXTRA_CC_PRE) ../../pelican.c -o ${OBJECTDIR}/_ext/43898991/pelican.o -c -mcpu=$(MP_PROCESSOR_OPTION) -MMD -MF "${OBJECTDIR}/_ext/43898991/pelican.o.d" -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Os -I"../.." -I"../../../../../include" -I"../../../../../src" -I"../../../../../ports/pic24_dspic/qv/xc16" -DNDEBUG -msmart-io=1 -Wall -msfr-warn=off @${FIXDEPS} "${OBJECTDIR}/_ext/43898991/pelican.o.d" $(SILENT) -rsi ${MP_CC_DIR}../ endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemble ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: assemblePreproc ifeq ($(TYPE_IMAGE), DEBUG_RUN) else endif # ------------------------------------------------------------------------------------ # Rules for buildStep: link ifeq ($(TYPE_IMAGE), DEBUG_RUN) dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -D__DEBUG=__DEBUG -D__MPLAB_DEBUGGER_PK3=1 -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -mreserve=data@0x800:0x81F -mreserve=data@0x820:0x821 -mreserve=data@0x822:0x823 -mreserve=data@0x824:0x825 -mreserve=data@0x826:0x84F -Wl,,,--defsym=__MPLAB_BUILD=1,--defsym=__MPLAB_DEBUG=1,--defsym=__DEBUG=1,-D__DEBUG=__DEBUG,--defsym=__MPLAB_DEBUGGER_PK3=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) else dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk @${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE} ${MP_CC} $(MP_EXTRA_LD_PRE) -o dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED} -mcpu=$(MP_PROCESSOR_OPTION) -omf=elf -DXPRJ_release=$(CND_CONF) -no-legacy-libc $(COMPARISON_BUILD) -Wl,,,--defsym=__MPLAB_BUILD=1,$(MP_LINKER_FILE_OPTION),--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--no-force-link,--smart-io,--report-mem,--memorysummary,dist/${CND_CONF}/${IMAGE_TYPE}/memoryfile.xml$(MP_EXTRA_LD_POST) ${MP_CC_DIR}\\xc16-bin2hex dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} -a -omf=elf endif # Subprojects .build-subprojects: # Subprojects .clean-subprojects: # Clean Targets .clean-conf: ${CLEAN_SUBPROJECTS} ${RM} -r build/release ${RM} -r dist/release # Enable dependency checking .dep.inc: .depcheck-impl DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES}) ifneq (${DEPFILES},) include ${DEPFILES} endif ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Makefile-variables.mk ================================================ # # Generated - do not edit! # # NOCDDL # CND_BASEDIR=`pwd` # default configuration CND_ARTIFACT_DIR_default=dist/default/production CND_ARTIFACT_NAME_default=xc16.production.hex CND_ARTIFACT_PATH_default=dist/default/production/xc16.production.hex CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package CND_PACKAGE_NAME_default=xc16.tar CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/xc16.tar # release configuration CND_ARTIFACT_DIR_release=dist/release/production CND_ARTIFACT_NAME_release=xc16.production.hex CND_ARTIFACT_PATH_release=dist/release/production/xc16.production.hex CND_PACKAGE_DIR_release=${CND_DISTDIR}/release/package CND_PACKAGE_NAME_release=xc16.tar CND_PACKAGE_PATH_release=${CND_DISTDIR}/release/package/xc16.tar ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Package-default.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=default CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/Package-release.bash ================================================ #!/bin/bash -x # # Generated - do not edit! # # Macros TOP=`pwd` CND_CONF=release CND_DISTDIR=dist TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging TMPDIRNAME=tmp-packaging OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} OUTPUT_BASENAME=xc16.${IMAGE_TYPE}.${OUTPUT_SUFFIX} PACKAGE_TOP_DIR=xc16/ # Functions function checkReturnCode { rc=$? if [ $rc != 0 ] then exit $rc fi } function makeDirectory # $1 directory path # $2 permission (optional) { mkdir -p "$1" checkReturnCode if [ "$2" != "" ] then chmod $2 "$1" checkReturnCode fi } function copyFileToTmpDir # $1 from-file path # $2 to-file path # $3 permission { cp "$1" "$2" checkReturnCode if [ "$3" != "" ] then chmod $3 "$2" checkReturnCode fi } # Setup cd "${TOP}" mkdir -p ${CND_DISTDIR}/${CND_CONF}/package rm -rf ${TMPDIR} mkdir -p ${TMPDIR} # Copy files and create directories and links cd "${TOP}" makeDirectory ${TMPDIR}/xc16/bin copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755 # Generate tar file cd "${TOP}" rm -f ${CND_DISTDIR}/${CND_CONF}/package/xc16.tar cd ${TMPDIR} tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/xc16.tar * checkReturnCode # Cleanup cd "${TOP}" rm -rf ${TMPDIR} ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/configurations.xml ================================================ ../../../../../src/qfn/qepn.c ../../../../../src/qfn/qfn.c ../../../../../src/qvn/qvn.c bsp.c ../../../../../include/qstamp.c ../../bsp.h ../../main.c ../../pelican.c ../../pelican.h ../../qpn_conf.h Makefile ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn Makefile localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false localhost PIC24FJ64GB002 PKOBSKDEPlatformTool XC16 1.36 3 false false false false false false false ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/private/configurations.xml ================================================ Makefile 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 :=MPLABComm-USB-Microchip:=<vid>04D8:=<pid>8107:=<rev>0002:=<man>Microchip Technology Incorporated:=<prod>Microstick II SK:=<sn>BUR123045184:=<drv>x:=<xpt>h:=end C:\tools\Microchip\xc16\bin place holder 1 place holder 2 true 0 0 0 ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/private/private.properties ================================================ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/private/private.xml ================================================ file:/C:/qp_lab/qpn/ports/pic24_dspic/qk/xc16/qkn_port.c file:/C:/qp_lab/qpn/examples/pic24_dspic/pelican_microstick2-pic24.X/main.c file:/C:/qp_lab/qpn/examples/pic24_dspic/pelican_microstick2-pic24.X/qv/xc16/bsp.c ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/project.properties ================================================ ================================================ FILE: examples/pic24_dspic/pelican_microstick2-pic24/qv/xc16/nbproject/project.xml ================================================ com.microchip.mplab.nbide.embedded.makeproject pelican-microstick2-pic24-qvn ee2d0599-d83a-4c0e-b85a-bafd0cebc5f8 0 c h ISO-8859-1 ../../../../../src/qf ../../../../../src/qk ../../../../../include ../../../../../src/qs ../.. ../../../../../src/qv ../../../../../ports/pic24_dspic/qk/xc16 ../../../../../src/qfn ../../../../../src/qkn ../../../../../src/qvn default 2 release 2 false ================================================ FILE: examples/workstation/README.txt ================================================ ABOUT THE "Workstation" EXAMPLES ================================ The examples in the "workstation" directory can be built on any workstation (Windows, Linux, and MacOS). The provided Makefiles support the GNU GCC toolchain. *** NOTE *** For Windows, the make utility and the GNU GCC toolchain (MinGW) are provided in the QTools collection, which is available for a separate download from: http://sourceforge.net/projects/qpc/files/QTools/ *** NOTE *** The code can be also built with other tools as well, such as the Microsoft Visual Studio 2013 and newer. The QP-nano Code ============= The QP-nano framework is built from sources in every provided project. Debug and Release Build Configurations ============================================ The Makefiles for the examples generally support the following two build configurations: Debug Configuration ------------------- This is the default build configuration, with full debugging information and minimal optimization. To build this configuration, type: make To clean this build, type make clean The object files and the executable is located in the 'build' sub-directory. Release Configuration --------------------- This configuration is built with no debugging information and high optimization. Single-stepping and debugging might be difficult due to the lack of debugging information and optimized code. To build this configuration, type: make CONF=rel To clean this build, type make CONF=rel clean The object files and the executable is located in the 'build_rel' directory. Support and Contact Information =============================== https://sourceforge.net/p/qpc/discussion/668726/ https://www.state-machine.com info@state-machine.com ================================================ FILE: examples/workstation/blinky/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := blinky #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ blinky.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/blinky/README.txt ================================================ This example corresponds to the QM Tutorial at: https://www.state-machine.com/qm/gs_tut.html Specifically the files are as follows: blinky.qm - the QM model for the Blinky active object blinky.c - the generated code for the Blinky application qpn_conf.h - the QP-nano configuration file Makefile - the makefile to build Blinky on Windows/Linux/MaxOS ================================================ FILE: examples/workstation/blinky/blinky.c ================================================ /*.$file${.::blinky.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: blinky.qm * File: ${.::blinky.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::blinky.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano framework API */ #include "safe_std.h" /* portable "safe" / facilities */ #include /* for exit() */ enum { BSP_TICKS_PER_SEC = 100 }; void BSP_init(void) { PRINTF_S("Simple Blinky example\n" "QP-nano version: %s\n" "Press Ctrl-C to quit...\n", QP_VERSION_STR); } void BSP_ledOff(void) { PRINTF_S("%s\n", "LED OFF"); } void BSP_ledOn(void) { PRINTF_S("%s\n", "LED ON"); } /* callback functions needed by the framework ------------------------------*/ void QF_onStartup(void) {} void QF_onCleanup(void) {} void QF_onClockTickISR(void) { QF_tickXISR(0U); /* QF-nano clock tick processing for rate 0 */ } Q_NORETURN Q_onAssert(char_t const Q_ROM * const module, int_t loc) { FPRINTF_S(stderr, "Assertion failed in %s:%d", module, loc); exit(-1); } /* ask QM to declare the Blinky class --------------------------------------*/ /*.$declare${AOs::Blinky_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Blinky_ctor} .....................................................*/ static void Blinky_ctor(void); /*.$enddecl${AOs::Blinky_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Blinky} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Blinky} ..........................................................*/ typedef struct Blinky { /* protected: */ QActive super; } Blinky; /* protected: */ static QState Blinky_initial(Blinky * const me); static QState Blinky_off(Blinky * const me); static QState Blinky_on(Blinky * const me); /*.$enddecl${AOs::Blinky} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* the single instance of the Blinky active object -------------------------*/ Blinky AO_Blinky; /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /* the main function -------------------------------------------------------*/ int main(void) { QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ Blinky_ctor(); /* in C you must explicitly call the Blinky constructor */ return QF_run(); /* transfer control to QF-nano */ } /* ask QM to define the Blinky class ---------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Blinky_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Blinky_ctor} .....................................................*/ static void Blinky_ctor(void) { Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); } /*.$enddef${AOs::Blinky_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Blinky} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Blinky} ..........................................................*/ /*.${AOs::Blinky::SM} ......................................................*/ static QState Blinky_initial(Blinky * const me) { /*.${AOs::Blinky::SM::initial} */ /* arm the private time event for tick rate 0 * to expire in 1/2s and periodically every 1/2 second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); return Q_TRAN(&Blinky_off); } /*.${AOs::Blinky::SM::off} .................................................*/ static QState Blinky_off(Blinky * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Blinky::SM::off} */ case Q_ENTRY_SIG: { BSP_ledOff(); status_ = Q_HANDLED(); break; } /*.${AOs::Blinky::SM::off::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Blinky_on); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Blinky::SM::on} ..................................................*/ static QState Blinky_on(Blinky * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Blinky::SM::on} */ case Q_ENTRY_SIG: { BSP_ledOn(); status_ = Q_HANDLED(); break; } /*.${AOs::Blinky::SM::on::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Blinky_off); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Blinky} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/blinky/blinky.qm ================================================ Simple Blinky example for QP-nano, which demonstrates: - Active object (Blinky) with state machine - Board Support Package abstraction for portability - BSP implementation for desktop OS (Windows, Linux, Mac) - Platform-independent main() function - make.bat batch file for Windows /* arm the private time event for tick rate 0 * to expire in 1/2s and periodically every 1/2 second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); BSP_ledOff(); BSP_ledOn(); The Blinky "constructor" is provided outside of the Blinky class, so that it can be used independently from the class. This is part of the "opaque pointer" design idiom. Blinky * const me = &AO_Blinky; QActive_ctor(&me->super, Q_STATE_CAST(&Blinky_initial)); #include "qpn.h" /* QP-nano framework API */ #include <stdio.h> #include <stdlib.h> /* for exit() */ enum { BSP_TICKS_PER_SEC = 100 }; void BSP_init(void) { printf("Simple Blinky example\n" "QP-nano version: %s\n" "Press Ctrl-C to quit...\n", QP_VERSION_STR); } void BSP_ledOff(void) { printf("LED OFF\n"); } void BSP_ledOn(void) { printf("LED ON\n"); } /* callback functions needed by the framework ------------------------------*/ void QF_onStartup(void) {} void QF_onCleanup(void) {} void QF_onClockTickISR(void) { QF_tickXISR(0U); /* QF-nano clock tick processing for rate 0 */ } void Q_onAssert(char_t const Q_ROM * const module, int_t loc) { fprintf(stderr, "Assertion failed in %s:%d", module, loc); exit(-1); } /* ask QM to declare the Blinky class --------------------------------------*/ $declare${AOs::Blinky_ctor} $declare${AOs::Blinky} /* the single instance of the Blinky active object -------------------------*/ Blinky AO_Blinky; /* Local-scope objects -----------------------------------------------------*/ static QEvt l_blinkyQSto[10]; /* Event queue storage for Blinky */ /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Blinky, l_blinkyQSto, Q_DIM(l_blinkyQSto) } }; /* the main function -------------------------------------------------------*/ int main(void) { QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ Blinky_ctor(); /* in C you must explicitly call the Blinky constructor */ return QF_run(); /* transfer control to QF-nano */ } /* ask QM to define the Blinky class ---------------------------------------*/ $define${AOs::Blinky_ctor} $define${AOs::Blinky} #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4 #define QF_MAX_TICK_RATE 1 #define QF_TIMEEVT_CTR_SIZE 2 #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/blinky/qpn_conf.h ================================================ /*.$file${.::qpn_conf.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: blinky.qm * File: ${.::qpn_conf.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::qpn_conf.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/calc/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := calc #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ calc.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/calc/bsp.c ================================================ /***************************************************************************** * Product: Board Support Package (BSP) for the Calculator example * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "calc.h" #include "safe_std.h" /* portable "safe" / facilities */ #include #define DISP_WIDTH 9 /*..........................................................................*/ /* dummy definition of the QF_active[] array (not used in this example) */ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U } }; /*..........................................................................*/ static char l_display[DISP_WIDTH + 1]; /* the calculator display */ static int l_len; /* number of displayed characters */ /*..........................................................................*/ void BSP_clear(void) { memset(l_display, ' ', DISP_WIDTH - 1); l_display[DISP_WIDTH - 1] = '0'; l_display[DISP_WIDTH] = '\0'; l_len = 0; } /*..........................................................................*/ void BSP_insert(int keyId) { if (l_len == 0) { l_display[DISP_WIDTH - 1] = (char)keyId; ++l_len; } else if (l_len < (DISP_WIDTH - 1)) { MEMMOVE_S(&l_display[0], DISP_WIDTH, &l_display[1], DISP_WIDTH - 1); l_display[DISP_WIDTH - 1] = (char)keyId; ++l_len; } } /*..........................................................................*/ void BSP_negate(void) { BSP_clear(); l_display[DISP_WIDTH - 2] = '-'; } /*..........................................................................*/ void BSP_display(void) { PRINTF_S("\n[%s] ", l_display); } /*..........................................................................*/ void BSP_exit(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_onCleanup(); exit(0); } /*..........................................................................*/ double BSP_get_value(void) { return strtod(l_display, (char **)0); } /*..........................................................................*/ int BSP_eval(double operand1, int oper, double operand2) { int ok = 1; double result = 0.0; switch (oper) { case KEY_PLUS: { result = operand1 + operand2; break; } case KEY_MINUS: { result = operand1 - operand2; break; } case KEY_MULT: { result = operand1 * operand2; break; } case KEY_DIVIDE: { if ((operand2 < -1e-30) || (1e-30 < operand2)) { result = operand1 / operand2; } else { /* error: divide by zero */ STRCPY_S(l_display, DISP_WIDTH, " Error 0 "); ok = 0; } break; } } if (ok) { if ((-0.000001 < result) && (result < 0.000001)) { result = 0.0; } if ((-99999999.0 < result) && (result < 99999999.0)) { SNPRINTF_S(l_display, DISP_WIDTH, "%9.6g", result); } else { /* error: out of range */ STRCPY_S(l_display, DISP_WIDTH, " Error 1 "); ok = 0; } } return ok; } /*..........................................................................*/ void BSP_message(char const *msg) { PRINTF_S("%s", msg); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); } /*..........................................................................*/ void QF_onCleanup(void) { QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { } /*..........................................................................*/ /* this function is used by the QP embedded systems-friendly assertions */ Q_NORETURN Q_onAssert(char const * const file, int line) { FPRINTF_S(stderr, "Assertion failed in %s, line %d", file, line); exit(-1); } ================================================ FILE: examples/workstation/calc/bsp.h ================================================ /***************************************************************************** * Product: Board Support Package (BSP) for the Calculator example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define KEY_PLUS '+' #define KEY_MINUS '-' #define KEY_MULT '*' #define KEY_DIVIDE '/' void BSP_clear (void); void BSP_negate(void); void BSP_insert(int keyId); double BSP_get_value(void); int BSP_eval(double operand1, int oper, double operand2); void BSP_exit(void); void BSP_display(void); void BSP_message(char const *state); #endif /* BSP_H */ ================================================ FILE: examples/workstation/calc/calc.c ================================================ /*.$file${.::calc.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: calc.qm * File: ${.::calc.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::calc.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "calc.h" /* this applicatin */ /*.$declare${SMs::Calc} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::Calc} ............................................................*/ typedef struct Calc { /* protected: */ QHsm super; /* private: */ double operand1; uint8_t operator; } Calc; /* protected: */ static QState Calc_initial(Calc * const me); static QState Calc_on(Calc * const me); static QState Calc_error(Calc * const me); static QState Calc_ready(Calc * const me); static QState Calc_result(Calc * const me); static QState Calc_begin(Calc * const me); static QState Calc_operand1(Calc * const me); static QState Calc_zero1(Calc * const me); static QState Calc_int1(Calc * const me); static QState Calc_frac1(Calc * const me); static QState Calc_negated1(Calc * const me); static QState Calc_opEntered(Calc * const me); static QState Calc_operand2(Calc * const me); static QState Calc_zero2(Calc * const me); static QState Calc_int2(Calc * const me); static QState Calc_frac2(Calc * const me); static QState Calc_negated2(Calc * const me); static QState Calc_final(Calc * const me); /*.$enddecl${SMs::Calc} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ static Calc l_calc; /* the only instance of the Calc class */ /* global-scope definitions ---------------------------------------*/ QHsm * const the_calc = &l_calc.super; /* "opaque" pointer to HSM */ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${SMs::Calc_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::Calc_ctor} .......................................................*/ void Calc_ctor(void) { Calc *me = &l_calc; QHsm_ctor(&me->super, Q_STATE_CAST(&Calc_initial)); } /*.$enddef${SMs::Calc_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${SMs::Calc} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::Calc} ............................................................*/ /*.${SMs::Calc::SM} ........................................................*/ static QState Calc_initial(Calc * const me) { /*.${SMs::Calc::SM::initial} */ BSP_clear(); return Q_TRAN(&Calc_on); } /*.${SMs::Calc::SM::on} ....................................................*/ static QState Calc_on(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on} */ case Q_ENTRY_SIG: { BSP_message("on-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on} */ case Q_EXIT_SIG: { BSP_message("on-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::initial} */ case Q_INIT_SIG: { BSP_message("on-INIT;"); status_ = Q_TRAN(&Calc_ready); break; } /*.${SMs::Calc::SM::on::C} */ case C_SIG: { BSP_clear(); status_ = Q_TRAN(&Calc_on); break; } /*.${SMs::Calc::SM::on::OFF} */ case OFF_SIG: { status_ = Q_TRAN(&Calc_final); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${SMs::Calc::SM::on::error} .............................................*/ static QState Calc_error(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::error} */ case Q_ENTRY_SIG: { BSP_message("error-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::error} */ case Q_EXIT_SIG: { BSP_message("error-EXIT;"); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_on); break; } } return status_; } /*.${SMs::Calc::SM::on::ready} .............................................*/ static QState Calc_ready(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::ready} */ case Q_ENTRY_SIG: { BSP_message("ready-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::ready} */ case Q_EXIT_SIG: { BSP_message("ready-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::ready::initial} */ case Q_INIT_SIG: { BSP_message("ready-INIT;"); status_ = Q_TRAN(&Calc_begin); break; } /*.${SMs::Calc::SM::on::ready::DIGIT_0} */ case DIGIT_0_SIG: { BSP_clear(); status_ = Q_TRAN(&Calc_zero1); break; } /*.${SMs::Calc::SM::on::ready::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_clear(); BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int1); break; } /*.${SMs::Calc::SM::on::ready::POINT} */ case POINT_SIG: { BSP_clear(); BSP_insert((int)'0'); BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac1); break; } /*.${SMs::Calc::SM::on::ready::OPER} */ case OPER_SIG: { me->operand1 = BSP_get_value(); me->operator = Q_PAR(me); status_ = Q_TRAN(&Calc_opEntered); break; } default: { status_ = Q_SUPER(&Calc_on); break; } } return status_; } /*.${SMs::Calc::SM::on::ready::result} .....................................*/ static QState Calc_result(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::ready::result} */ case Q_ENTRY_SIG: { BSP_message("result-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::ready::result} */ case Q_EXIT_SIG: { BSP_message("result-EXIT;"); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_ready); break; } } return status_; } /*.${SMs::Calc::SM::on::ready::begin} ......................................*/ static QState Calc_begin(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::ready::begin} */ case Q_ENTRY_SIG: { BSP_message("begin-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::ready::begin} */ case Q_EXIT_SIG: { BSP_message("begin-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::ready::begin::OPER} */ case OPER_SIG: { /*.${SMs::Calc::SM::on::ready::begin::OPER::[e->key=='-']} */ if (Q_PAR(me) == KEY_MINUS) { status_ = Q_TRAN(&Calc_negated1); } /*.${SMs::Calc::SM::on::ready::begin::OPER::[else]} */ else { status_ = Q_HANDLED(); } break; } default: { status_ = Q_SUPER(&Calc_ready); break; } } return status_; } /*.${SMs::Calc::SM::on::operand1} ..........................................*/ static QState Calc_operand1(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand1} */ case Q_ENTRY_SIG: { BSP_message("operand1-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1} */ case Q_EXIT_SIG: { BSP_message("operand1-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::CE} */ case CE_SIG: { BSP_clear(); status_ = Q_TRAN(&Calc_begin); break; } /*.${SMs::Calc::SM::on::operand1::OPER} */ case OPER_SIG: { me->operand1 = BSP_get_value(); me->operator = Q_PAR(me); status_ = Q_TRAN(&Calc_opEntered); break; } /*.${SMs::Calc::SM::on::operand1::EQUALS} */ case EQUALS_SIG: { status_ = Q_TRAN(&Calc_result); break; } default: { status_ = Q_SUPER(&Calc_on); break; } } return status_; } /*.${SMs::Calc::SM::on::operand1::zero1} ...................................*/ static QState Calc_zero1(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand1::zero1} */ case Q_ENTRY_SIG: { BSP_message("zero1-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::zero1} */ case Q_EXIT_SIG: { BSP_message("zero1-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::zero1::DIGIT_0} */ case DIGIT_0_SIG: { ; status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::zero1::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int1); break; } /*.${SMs::Calc::SM::on::operand1::zero1::POINT} */ case POINT_SIG: { BSP_insert((int)'0'); BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac1); break; } default: { status_ = Q_SUPER(&Calc_operand1); break; } } return status_; } /*.${SMs::Calc::SM::on::operand1::int1} ....................................*/ static QState Calc_int1(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand1::int1} */ case Q_ENTRY_SIG: { BSP_message("int1-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::int1} */ case Q_EXIT_SIG: { BSP_message("int1-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::int1::POINT} */ case POINT_SIG: { BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac1); break; } /*.${SMs::Calc::SM::on::operand1::int1::DIGIT_0, DIGIT_1_9} */ case DIGIT_0_SIG: /* intentionally fall through */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_operand1); break; } } return status_; } /*.${SMs::Calc::SM::on::operand1::frac1} ...................................*/ static QState Calc_frac1(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand1::frac1} */ case Q_ENTRY_SIG: { BSP_message("frac1-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::frac1} */ case Q_EXIT_SIG: { BSP_message("frac1-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::frac1::POINT} */ case POINT_SIG: { ; status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::frac1::DIGIT_0, DIGIT_1_9} */ case DIGIT_0_SIG: /* intentionally fall through */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_operand1); break; } } return status_; } /*.${SMs::Calc::SM::on::operand1::negated1} ................................*/ static QState Calc_negated1(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand1::negated1} */ case Q_ENTRY_SIG: { BSP_message("negated1-ENTRY;"); BSP_negate(); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::negated1} */ case Q_EXIT_SIG: { BSP_message("negated1-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand1::negated1::DIGIT_0} */ case DIGIT_0_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_zero1); break; } /*.${SMs::Calc::SM::on::operand1::negated1::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int1); break; } /*.${SMs::Calc::SM::on::operand1::negated1::POINT} */ case POINT_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_frac1); break; } /*.${SMs::Calc::SM::on::operand1::negated1::OPER} */ case OPER_SIG: { /*.${SMs::Calc::SM::on::operand1::negated1::OPER::[e->key=='-']} */ if (Q_PAR(me) == KEY_MINUS) { ; status_ = Q_HANDLED(); } /*.${SMs::Calc::SM::on::operand1::negated1::OPER::[else]} */ else { status_ = Q_HANDLED(); } break; } default: { status_ = Q_SUPER(&Calc_operand1); break; } } return status_; } /*.${SMs::Calc::SM::on::opEntered} .........................................*/ static QState Calc_opEntered(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::opEntered} */ case Q_ENTRY_SIG: { BSP_message("opEntered-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::opEntered} */ case Q_EXIT_SIG: { BSP_message("opEntered-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::opEntered::DIGIT_0} */ case DIGIT_0_SIG: { BSP_clear(); status_ = Q_TRAN(&Calc_zero2); break; } /*.${SMs::Calc::SM::on::opEntered::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_clear(); BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int2); break; } /*.${SMs::Calc::SM::on::opEntered::POINT} */ case POINT_SIG: { BSP_clear(); BSP_insert((int)'0'); BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac2); break; } /*.${SMs::Calc::SM::on::opEntered::OPER} */ case OPER_SIG: { /*.${SMs::Calc::SM::on::opEntered::OPER::[e->key=='-']} */ if (Q_PAR(me) == KEY_MINUS) { status_ = Q_TRAN(&Calc_negated2); } /*.${SMs::Calc::SM::on::opEntered::OPER::[else]} */ else { status_ = Q_HANDLED(); } break; } default: { status_ = Q_SUPER(&Calc_on); break; } } return status_; } /*.${SMs::Calc::SM::on::operand2} ..........................................*/ static QState Calc_operand2(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand2} */ case Q_ENTRY_SIG: { BSP_message("operand2-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2} */ case Q_EXIT_SIG: { BSP_message("operand2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::CE} */ case CE_SIG: { BSP_clear(); status_ = Q_TRAN(&Calc_opEntered); break; } /*.${SMs::Calc::SM::on::operand2::EQUALS} */ case EQUALS_SIG: { /*.${SMs::Calc::SM::on::operand2::EQUALS::[BSP_eval()]} */ if (BSP_eval(me->operand1, me->operator, BSP_get_value())) { status_ = Q_TRAN(&Calc_result); } /*.${SMs::Calc::SM::on::operand2::EQUALS::[else]} */ else { status_ = Q_TRAN(&Calc_error); } break; } /*.${SMs::Calc::SM::on::operand2::OPER} */ case OPER_SIG: { /*.${SMs::Calc::SM::on::operand2::OPER::[BSP_eval()]} */ if (BSP_eval(me->operand1, me->operator, BSP_get_value())) { me->operand1 = BSP_get_value(); status_ = Q_TRAN(&Calc_opEntered); } /*.${SMs::Calc::SM::on::operand2::OPER::[else]} */ else { status_ = Q_TRAN(&Calc_error); } break; } default: { status_ = Q_SUPER(&Calc_on); break; } } return status_; } /*.${SMs::Calc::SM::on::operand2::zero2} ...................................*/ static QState Calc_zero2(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand2::zero2} */ case Q_ENTRY_SIG: { BSP_message("zero2-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::zero2} */ case Q_EXIT_SIG: { BSP_message("zero2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::zero2::DIGIT_0} */ case DIGIT_0_SIG: { ; status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::zero2::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int2); break; } /*.${SMs::Calc::SM::on::operand2::zero2::POINT} */ case POINT_SIG: { BSP_insert((int)'0'); BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac2); break; } default: { status_ = Q_SUPER(&Calc_operand2); break; } } return status_; } /*.${SMs::Calc::SM::on::operand2::int2} ....................................*/ static QState Calc_int2(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand2::int2} */ case Q_ENTRY_SIG: { BSP_message("int2-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::int2} */ case Q_EXIT_SIG: { BSP_message("int2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::int2::POINT} */ case POINT_SIG: { BSP_insert((int)'.'); status_ = Q_TRAN(&Calc_frac2); break; } /*.${SMs::Calc::SM::on::operand2::int2::DIGIT_0, DIGIT_1_9} */ case DIGIT_0_SIG: /* intentionally fall through */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_operand2); break; } } return status_; } /*.${SMs::Calc::SM::on::operand2::frac2} ...................................*/ static QState Calc_frac2(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand2::frac2} */ case Q_ENTRY_SIG: { BSP_message("frac2-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::frac2} */ case Q_EXIT_SIG: { BSP_message("frac2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::frac2::POINT} */ case POINT_SIG: { ; status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::frac2::DIGIT_0, DIGIT_1_9} */ case DIGIT_0_SIG: /* intentionally fall through */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Calc_operand2); break; } } return status_; } /*.${SMs::Calc::SM::on::operand2::negated2} ................................*/ static QState Calc_negated2(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::on::operand2::negated2} */ case Q_ENTRY_SIG: { BSP_message("negated2-ENTRY;"); BSP_negate(); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::negated2} */ case Q_EXIT_SIG: { BSP_message("negated2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${SMs::Calc::SM::on::operand2::negated2::DIGIT_0} */ case DIGIT_0_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_zero2); break; } /*.${SMs::Calc::SM::on::operand2::negated2::DIGIT_1_9} */ case DIGIT_1_9_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_int2); break; } /*.${SMs::Calc::SM::on::operand2::negated2::POINT} */ case POINT_SIG: { BSP_insert(Q_PAR(me)); status_ = Q_TRAN(&Calc_frac2); break; } /*.${SMs::Calc::SM::on::operand2::negated2::OPER} */ case OPER_SIG: { /*.${SMs::Calc::SM::on::operand2::negated2::OPER::[e->key=='-']} */ if (Q_PAR(me) == KEY_MINUS) { ; status_ = Q_HANDLED(); } /*.${SMs::Calc::SM::on::operand2::negated2::OPER::[else]} */ else { status_ = Q_HANDLED(); } break; } default: { status_ = Q_SUPER(&Calc_operand2); break; } } return status_; } /*.${SMs::Calc::SM::final} .................................................*/ static QState Calc_final(Calc * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::Calc::SM::final} */ case Q_ENTRY_SIG: { BSP_message("final-ENTRY;"); BSP_exit(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${SMs::Calc} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/calc/calc.h ================================================ /*.$file${.::calc.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: calc.qm * File: ${.::calc.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::calc.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef CALC_H #define CALC_H enum CalcSignals { C_SIG = Q_USER_SIG, CE_SIG, DIGIT_0_SIG, DIGIT_1_9_SIG, POINT_SIG, OPER_SIG, EQUALS_SIG, OFF_SIG }; /*.$declare${SMs::Calc_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::Calc_ctor} .......................................................*/ void Calc_ctor(void); /*.$enddecl${SMs::Calc_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ extern QHsm * const the_calc; /* "opaque" pointer to calculator HSM */ #endif /* CALC_H */ ================================================ FILE: examples/workstation/calc/calc.qm ================================================ Calc is the model of the Calculator described in Chapter 4 of PSiCC2 Calculator state machine BSP_clear(); BSP_message("on-ENTRY;"); BSP_message("on-EXIT;"); BSP_message("on-INIT;"); BSP_clear(); BSP_message("error-ENTRY;"); BSP_message("error-EXIT;"); BSP_message("ready-ENTRY;"); BSP_message("ready-EXIT;"); BSP_message("ready-INIT;"); BSP_clear(); BSP_clear(); BSP_insert(Q_PAR(me)); BSP_clear(); BSP_insert((int)'0'); BSP_insert((int)'.'); me->operand1 = BSP_get_value(); me->operator = Q_PAR(me); BSP_message("result-ENTRY;"); BSP_message("result-EXIT;"); BSP_message("begin-ENTRY;"); BSP_message("begin-EXIT;"); Q_PAR(me) == KEY_MINUS else BSP_message("operand1-ENTRY;"); BSP_message("operand1-EXIT;"); BSP_clear(); me->operand1 = BSP_get_value(); me->operator = Q_PAR(me); BSP_message("zero1-ENTRY;"); BSP_message("zero1-EXIT;"); ; BSP_insert(Q_PAR(me)); BSP_insert((int)'0'); BSP_insert((int)'.'); BSP_message("int1-ENTRY;"); BSP_message("int1-EXIT;"); BSP_insert((int)'.'); BSP_insert(Q_PAR(me)); BSP_message("frac1-ENTRY;"); BSP_message("frac1-EXIT;"); ; BSP_insert(Q_PAR(me)); BSP_message("negated1-ENTRY;"); BSP_negate(); BSP_message("negated1-EXIT;"); BSP_insert(Q_PAR(me)); BSP_insert(Q_PAR(me)); BSP_insert(Q_PAR(me)); else Q_PAR(me) == KEY_MINUS ; BSP_message("opEntered-ENTRY;"); BSP_message("opEntered-EXIT;"); BSP_clear(); BSP_clear(); BSP_insert(Q_PAR(me)); BSP_clear(); BSP_insert((int)'0'); BSP_insert((int)'.'); Q_PAR(me) == KEY_MINUS else BSP_message("operand2-ENTRY;"); BSP_message("operand2-EXIT;"); BSP_clear(); else BSP_eval(me->operand1, me->operator, BSP_get_value()) else BSP_eval(me->operand1, me->operator, BSP_get_value()) me->operand1 = BSP_get_value(); BSP_message("zero2-ENTRY;"); BSP_message("zero2-EXIT;"); ; BSP_insert(Q_PAR(me)); BSP_insert((int)'0'); BSP_insert((int)'.'); BSP_message("int2-ENTRY;"); BSP_message("int2-EXIT;"); BSP_insert((int)'.'); BSP_insert(Q_PAR(me)); BSP_message("frac2-ENTRY;"); BSP_message("frac2-EXIT;"); ; BSP_insert(Q_PAR(me)); BSP_message("negated2-ENTRY;"); BSP_negate(); BSP_message("negated2-EXIT;"); BSP_insert(Q_PAR(me)); BSP_insert(Q_PAR(me)); BSP_insert(Q_PAR(me)); else Q_PAR(me) == KEY_MINUS ; BSP_message("final-ENTRY;"); BSP_exit(); constructor Calc *me = &l_calc; QHsm_ctor(&me->super, Q_STATE_CAST(&Calc_initial)); #ifndef CALC_H #define CALC_H enum CalcSignals { C_SIG = Q_USER_SIG, CE_SIG, DIGIT_0_SIG, DIGIT_1_9_SIG, POINT_SIG, OPER_SIG, EQUALS_SIG, OFF_SIG }; $declare(SMs::Calc_ctor) extern QHsm * const the_calc; /* "opaque" pointer to calculator HSM */ #endif /* CALC_H */ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "calc.h" /* this applicatin */ $declare(SMs::Calc) static Calc l_calc; /* the only instance of the Calc class */ /* global-scope definitions ---------------------------------------*/ QHsm * const the_calc = &l_calc.super; /* "opaque" pointer to HSM */ $define(SMs::Calc_ctor) $define(SMs::Calc) ================================================ FILE: examples/workstation/calc/main.c ================================================ /***************************************************************************** * Product: calc1_sub Example * Last updated for version 6.4.0 * Last updated on 2019-02-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "calc.h" #include "safe_std.h" /* portable "safe" / facilities */ Q_DEFINE_THIS_FILE /*..........................................................................*/ int main() { QF_onStartup(); PRINTF_S("Calculator example, QP version: %s\n" "Press '0' .. '9' to enter a digit\n" "Press '.' to enter the decimal point\n" "Press '+' to add\n" "Press '-' to subtract or negate a number\n" "Press '*' to multiply\n" "Press '/' to divide\n" "Press '=' or to get the result\n" "Press 'c' or 'C' to Cancel\n" "Press 'e' or 'E' to Cancel Entry\n" "Press to quit.\n\n", QP_VERSION_STR); Calc_ctor(); /* explicitly instantiate the calculator object */ QHSM_INIT(the_calc); /* trigger initial transition */ for (;;) { /* event loop */ uint8_t sig; uint8_t par; BSP_display(); /* show the display */ PRINTF_S("%s", " : "); par = (uint8_t)QF_consoleWaitForKey(); PRINTF_S("%s", " "); switch (par) { case 'c': /* intentionally fall through */ case 'C': { sig = C_SIG; break; } case 'e': /* intentionally fall through */ case 'E': { sig = CE_SIG; break; } case '0': { sig = DIGIT_0_SIG; break; } case '1': /* intentionally fall through */ case '2': /* intentionally fall through */ case '3': /* intentionally fall through */ case '4': /* intentionally fall through */ case '5': /* intentionally fall through */ case '6': /* intentionally fall through */ case '7': /* intentionally fall through */ case '8': /* intentionally fall through */ case '9': { sig = DIGIT_1_9_SIG; break; } case '.': { sig = POINT_SIG; break; } case '+': /* intentionally fall through */ case '-': /* intentionally fall through */ case '*': /* intentionally fall through */ case '/': { sig = OPER_SIG; break; } case '=': /* intentionally fall through */ case '\r': { /* Enter key */ sig = EQUALS_SIG; break; } case '\33': { /* ESC key */ sig = OFF_SIG; break; } default: { sig = 0; /* invalid event */ break; } } if (sig != 0) { /* valid event generated? */ Q_SIG(the_calc) = sig; Q_PAR(the_calc) = par; QHSM_DISPATCH(the_calc); /* dispatch event */ } } return 0; } ================================================ FILE: examples/workstation/calc/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Calculator example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 1U #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/comp/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := comp #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ alarm.c \ comp.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/comp/alarm.c ================================================ /***************************************************************************** * Product: Orthogonal Component state pattern example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "clock.h" #include "safe_std.h" /* portable "safe" / facilities */ /* HSM methods */ static QState Alarm_initial(Alarm *me); static QState Alarm_on (Alarm *me); static QState Alarm_off (Alarm *me); /*..........................................................................*/ void Alarm_ctor(Alarm * const me) { QHsm_ctor(&me->super, Q_STATE_CAST(&Alarm_initial)); } /* HSM definition ----------------------------------------------------------*/ QState Alarm_initial(Alarm * const me) { me->alarm_time = 12U*60U; return Q_TRAN(&Alarm_off); } /*..........................................................................*/ QState Alarm_off(Alarm * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { /* while in the off state, the alarm is kept in decimal format */ me->alarm_time = (me->alarm_time/60U)*100U + me->alarm_time%60U; PRINTF_S("*** Alarm OFF %02d:%02d\n", me->alarm_time/100U, me->alarm_time%100); fflush(stdout); status = Q_HANDLED(); break; } case Q_EXIT_SIG: { /* upon exit, the alarm is converted to binary format */ me->alarm_time = (me->alarm_time/100U)*60U + me->alarm_time%100U; status = Q_HANDLED(); break; } case ALARM_ON_SIG: { /* alarm in range? */ if ((me->alarm_time / 100U < 24U) && (me->alarm_time % 100U < 60U)) { status = Q_TRAN(&Alarm_on); } else { /* alarm out of range -- clear and don't transition */ me->alarm_time = 0U; PRINTF_S("*** Alarm reset %02d:%02d\n", me->alarm_time/100U, me->alarm_time%100U); status = Q_HANDLED(); } break; } case ALARM_SET_SIG: { /* while setting, the alarm is kept in decimal format */ me->alarm_time = (10U * me->alarm_time + Q_PAR(me)) % 10000U; PRINTF_S("*** Alarm SET %02d:%02d\n", me->alarm_time/100U, me->alarm_time%100U); fflush(stdout); status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Alarm_on(Alarm * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("*** Alarm ON %02d:%02d\n", me->alarm_time/60, me->alarm_time%60); fflush(stdout); status = Q_HANDLED(); break; } case ALARM_SET_SIG: { PRINTF_S("%s\n", "*** Cannot set Alarm when it is ON"); fflush(stdout); status = Q_HANDLED(); break; } case ALARM_OFF_SIG: { status = Q_TRAN(&Alarm_off); break; } case TIME_SIG: { if (Q_PAR(me) == me->alarm_time) { PRINTF_S("%s\n", "ALARM!!!"); /* asynchronously post the event to the container AO */ QACTIVE_POST((QActive *)&AO_AlarmClock, ALARM_SIG, 0); } status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/workstation/comp/alarm.h ================================================ /***************************************************************************** * Product: Orthogonal Component state pattern example * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef ALARM_H #define ALARM_H typedef struct AlarmTag { QHsm super; /* inherit QHsm */ uint32_t alarm_time; } Alarm; void Alarm_ctor(Alarm * const me); #endif /* ALARM_H */ ================================================ FILE: examples/workstation/comp/bsp.c ================================================ /***************************************************************************** * Product: BSP for QP-nano Comp example, Win32 * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "clock.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*..........................................................................*/ void BSP_init(void) { PRINTF_S("Orthogonal Component state pattern\nQP-nano version: %s\n" "Press 'o' to turn the Alarm ON\n" "Press 'f' to turn the Alarm OFF\n" "Press '0'..'9' to set the Alarm time\n" "Press 'A' to set the Clock in 12-hour mode\n" "Press 'B' to set the Clock in 24-hour mode\n" "Press ESC to quit...\n", QP_VERSION_STR); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { uint8_t key; QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ key = QF_consoleGetKey(); switch (key) { case 'o': { /* 'o': Alarm on event? */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, ALARM_ON_SIG, 0); break; } case 'f': { /* 'f': Alarm off event? */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, ALARM_OFF_SIG, 0); break; } case '1': /* '1' */ case '2': /* '2' */ case '3': /* '3' */ case '4': /* '4' */ case '5': /* '5' */ case '6': /* '6' */ case '7': /* '7' */ case '8': /* '8' */ case '9': { /* '9' */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, ALARM_SET_SIG, key - '0'); break; } case '0': { /* '0' */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, ALARM_SET_SIG, 0U); break; } case 'a': { /* 'a': Clock 12H event? */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, CLOCK_12H_SIG, 0U); break; } case 'b': { /* 'b': Clock 24H event? */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, CLOCK_24H_SIG, 0U); break; } case '\33': { /* ESC pressed? */ QACTIVE_POST_ISR((QActive *)&AO_AlarmClock, TERMINATE_SIG, 0U); break; } } } /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const file, int_t line) { FPRINTF_S(stderr, "Assertion failed in %s, line %d", file, line); exit(-1); } ================================================ FILE: examples/workstation/comp/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); #endif /* BSP_H */ ================================================ FILE: examples/workstation/comp/clock.h ================================================ /***************************************************************************** * Product: Orthogonal Component state pattern example * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef CLOCK_H #define CLOCK_H #include "alarm.h" enum AlarmClockSignals { TERMINATE_SIG = Q_USER_SIG, TIME_SIG, ALARM_SET_SIG, ALARM_ON_SIG, ALARM_OFF_SIG, ALARM_SIG, CLOCK_12H_SIG, CLOCK_24H_SIG }; /* active objects ..........................................................*/ extern struct AlarmClockTag AO_AlarmClock; void AlarmClock_ctor(void); #endif /* CLOCK_H */ ================================================ FILE: examples/workstation/comp/comp.c ================================================ /***************************************************************************** * Product: "Orthogonal Component" state pattern example * Last updated for version 6.4.0 * Last updated on 2019-02-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "clock.h" #include "safe_std.h" /* portable "safe" / facilities */ Q_DEFINE_THIS_FILE /*..........................................................................*/ typedef struct AlarmClockTag { /* the AlarmClock active object */ QActive super; /* inherit QActive */ Alarm alarm; /* Alarm orthogonal component */ uint32_t current_time; /* the current time in seconds */ } AlarmClock; static QState AlarmClock_initial (AlarmClock * const me); static QState AlarmClock_timekeeping(AlarmClock * const me); static QState AlarmClock_mode12hr (AlarmClock * const me); static QState AlarmClock_mode24hr (AlarmClock * const me); static QState AlarmClock_final (AlarmClock * const me); /* Global objects ----------------------------------------------------------*/ AlarmClock AO_AlarmClock; /* the single instance of the AlarmClock AO */ /*..........................................................................*/ void AlarmClock_ctor(void) { QActive_ctor((QActive *)&AO_AlarmClock, Q_STATE_CAST(&AlarmClock_initial)); Alarm_ctor(&AO_AlarmClock.alarm); /* orthogonal component ctor */ } /* HSM definition ----------------------------------------------------------*/ QState AlarmClock_initial(AlarmClock * const me) { me->current_time = 0U; /* take the initial transition in the alarm component... */ QHSM_INIT(&me->alarm.super); return Q_TRAN(&AlarmClock_timekeeping); } /*..........................................................................*/ QState AlarmClock_final(AlarmClock * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", " -> final"); QF_stop(); /* terminate the application */ status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState AlarmClock_timekeeping(AlarmClock * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { /* timeout in one second and every second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC, BSP_TICKS_PER_SEC); status = Q_HANDLED(); break; } case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status = Q_HANDLED(); break; } case Q_INIT_SIG: { status = Q_TRAN(&AlarmClock_mode24hr); break; } case CLOCK_12H_SIG: { status = Q_TRAN(&AlarmClock_mode12hr); break; } case CLOCK_24H_SIG: { status = Q_TRAN(&AlarmClock_mode24hr); break; } case ALARM_SIG: { PRINTF_S("%s\n", "Wake up!!!"); status = Q_HANDLED(); break; } case ALARM_SET_SIG: case ALARM_ON_SIG: case ALARM_OFF_SIG: { /* synchronously dispatch to the orthogonal component */ Q_SIG(&me->alarm) = Q_SIG(me); Q_PAR(&me->alarm) = Q_PAR(me); QHSM_DISPATCH(&me->alarm.super); status = Q_HANDLED(); break; } case TERMINATE_SIG: { status = Q_TRAN(&AlarmClock_final); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState AlarmClock_mode24hr(AlarmClock * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "*** 24-hour mode"); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { /* roll over in 24-hr mode? */ if (++me->current_time == 24U*60U) { me->current_time = 0U; } PRINTF_S("%02d:%02d\n", me->current_time / 60U, me->current_time % 60U); /* synchronously dispatch to the orthogonal component */ Q_SIG(&me->alarm) = TIME_SIG; Q_PAR(&me->alarm) = me->current_time; QHSM_DISPATCH(&me->alarm.super); status = Q_HANDLED(); break; } default: { status = Q_SUPER(&AlarmClock_timekeeping); break; } } return status; } /*..........................................................................*/ QState AlarmClock_mode12hr(AlarmClock * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "*** 12-hour mode"); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { uint32_t h; /* temporary variable to hold hour */ if (++me->current_time == 12U * 60U) { /* roll over in 12-hr mode? */ me->current_time = 0U; } h = me->current_time / 60U; PRINTF_S("%02d:%02d %s\n", (h % 12U) ? (h % 12U) : 12U, me->current_time % 60U, (h / 12U) ? "PM" : "AM"); /* synchronously dispatch to the orthogonal component */ Q_SIG(&me->alarm) = TIME_SIG; Q_PAR(&me->alarm) = me->current_time; QHSM_DISPATCH(&me->alarm.super); status = Q_HANDLED(); break; } default: { status = Q_SUPER(&AlarmClock_timekeeping); break; } } return status; } ================================================ FILE: examples/workstation/comp/main.c ================================================ /***************************************************************************** * Product: Comp ("Orthogonal Component) example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "clock.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_clockQueue[3]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_AlarmClock, l_clockQueue, Q_DIM(l_clockQueue) } }; /*..........................................................................*/ int main (void) { AlarmClock_ctor(); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/comp/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Comp example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/defer/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := defer #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ defer.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/defer/bsp.c ================================================ /***************************************************************************** * Product: BSP for QP-nano "Deferred Event" state pattern example, Win32 * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "defer.h" /* Application interface */ #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*..........................................................................*/ void BSP_init(void) { } /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const file, int_t line) { FPRINTF_S(stderr, "Assertion failed in %s, line %d", file, line); exit(-1); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case 'n': { /* 'n': new request? */ static uint8_t reqCtr = 0U; /* count the requests */ QACTIVE_POST_ISR((QActive *)&AO_TServer, NEW_REQUEST_SIG, ++reqCtr); break; } case '\33': { /* ESC pressed? */ QACTIVE_POST_ISR((QActive *)&AO_TServer, TERMINATE_SIG, 0U); break; } } } ================================================ FILE: examples/workstation/defer/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-05-24 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); #endif /* BSP_H */ ================================================ FILE: examples/workstation/defer/defer.c ================================================ /***************************************************************************** * Product: "Deferred Event" state pattern example * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "defer.h" /* Application interface */ #include "safe_std.h" /* portable "safe" / facilities */ /*..........................................................................*/ typedef struct TServerTag { /* Transaction Server active object */ QActive super; /* inherit QActive */ QEvt deferredRequest; /* deferred request event */ /* optionally other storage for deferring other event types... */ } TServer; /* hierarchical state machine ... */ static QState TServer_initial (TServer * const me); static QState TServer_operational(TServer * const me); static QState TServer_idle (TServer * const me); static QState TServer_receiving (TServer * const me); static QState TServer_authorizing(TServer * const me); static QState TServer_final (TServer * const me); /* helper functions */ void TServer_deferRequest(TServer * const me); void TServer_recallRequest(TServer * const me); /* Global objects ----------------------------------------------------------*/ TServer AO_TServer; /* the single instance of the TServer active object */ /*..........................................................................*/ void TServer_ctor(void) { QActive_ctor((QActive *)&AO_TServer, Q_STATE_CAST(&TServer_initial)); } /* HSM definition ----------------------------------------------------------*/ QState TServer_initial(TServer * const me) { me->deferredRequest.sig = 0U; /* no deferred requests */ return Q_TRAN(&TServer_operational); } /*..........................................................................*/ QState TServer_final(TServer * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { QF_stop(); /* terminate the application */ status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState TServer_operational(TServer * const me) { QState status; switch (Q_SIG(me)) { case Q_INIT_SIG: { status = Q_TRAN(&TServer_idle); break; } case NEW_REQUEST_SIG: { TServer_deferRequest(me); /* defer the request */ status = Q_HANDLED(); break; } case TERMINATE_SIG: { status = Q_TRAN(&TServer_final); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState TServer_idle(TServer * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "-> idle"); TServer_recallRequest(me); /* recall the request */ status = Q_HANDLED(); break; } case NEW_REQUEST_SIG: { PRINTF_S("Processing request #%d\n", (int)Q_PAR(me)); status = Q_TRAN(&TServer_receiving); break; } default: { status = Q_SUPER(&TServer_operational); break; } } return status; } /*..........................................................................*/ QState TServer_receiving(TServer * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "-> receiving"); /* one-shot timeout in 1 second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC, 0U); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&TServer_authorizing); break; } default: { status = Q_SUPER(&TServer_operational); break; } } return status; } /*..........................................................................*/ QState TServer_authorizing(TServer * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "-> authorizing"); /* one-shot timeout in 2 seconds */ QActive_armX(&me->super, 0U, 2U*BSP_TICKS_PER_SEC, 0U); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { status = Q_TRAN(&TServer_idle); break; } default: { status = Q_SUPER(&TServer_operational); break; } } return status; } /* helper functions ........................................................*/ void TServer_deferRequest(TServer * const me) { if (me->deferredRequest.sig == 0U) { /* the request NOT deferred yet? */ me->deferredRequest.sig = Q_SIG(me); me->deferredRequest.par = Q_PAR(me); PRINTF_S("deferring request #%d\n", (int)me->deferredRequest.par); } else { PRINTF_S("!!! cannot defer request #%d\n", (int)Q_PAR(me)); } } void TServer_recallRequest(TServer * const me) { if (me->deferredRequest.sig != 0U) { /* the request already deferred? */ PRINTF_S("recalling request #%d\n", (int)me->deferredRequest.par); QACTIVE_POST(&me->super, me->deferredRequest.sig, me->deferredRequest.par); me->deferredRequest.sig = 0U; /* request no longer deferred */ } else { PRINTF_S("%s\n", "No requests to recall"); } } ================================================ FILE: examples/workstation/defer/defer.h ================================================ /***************************************************************************** * Product: Deferred Event state pattern example * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef DEFER_H #define DEFER_H enum TServerSignals { TERMINATE_SIG = Q_USER_SIG, /* terminate the application */ NEW_REQUEST_SIG /* new request to the server signal */ }; /* active objects ..........................................................*/ extern struct TServerTag AO_TServer; void TServer_ctor(void); #endif /* DEFER_H */ ================================================ FILE: examples/workstation/defer/main.c ================================================ /***************************************************************************** * Product: QP-nano "Deferred Event" state pattern example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "defer.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_serverQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_TServer, l_serverQueue, Q_DIM(l_serverQueue) } }; /*..........................................................................*/ int main (void) { TServer_ctor(); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/defer/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the "Deferred Event" example * Last updated for version 6.6.0 * Last updated on 2019-10-14 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 8 #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/dpp/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := dpp #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/dpp/bsp.c ================================================ /***************************************************************************** * Product: DPP example (console) * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /* local variables ---------------------------------------------------------*/ static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void BSP_init(void) { PRINTF_S("Dining Philosopher Problem example\n" "QP-nano %s\n" "Press 'p' to pause\n" "Press 's' to serve\n" "Press ESC to quit...\n", QP_VERSION_STR); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; QF_stop(); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char_t const *stat) { PRINTF_S("Philosopher %2d is %s\n", (int)n, stat); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { PRINTF_S("Paused is %s\n", paused ? "ON" : "OFF"); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /****************************************************************************/ /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const module, int_t id) { FPRINTF_S(stderr, "Assertion in %s:%d", module, id); BSP_terminate(-1); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case '\33': { /* see if the ESC key pressed */ BSP_terminate(0); break; } case 'p': { QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); break; } case 's': { QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); break; } default: { break; } } } ================================================ FILE: examples/workstation/dpp/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/workstation/dpp/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 /*.$declare${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo0; /*.$enddecl${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo1; /*.$enddecl${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo2; /*.$enddecl${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo3; /*.$enddecl${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Philo AO_Philo4; /*.$enddecl${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void); /*.$enddecl${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/workstation/dpp/dpp.qm ================================================ Dining Philosopher Problem example with QActive QActive_armX(&me->super, 0U, THINK_TIME, 0U); QActive_disarmX(&me->super, 0U); Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); Q_ERROR(); /* this event should never arrive in this state */ QActive_armX(&me->super, 0U, EAT_TIME, 0U); QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } BSP_terminate(0); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)5) #define PHILO_0_PRIO 1 $declare${AOs::AO_Philo0} $declare${AOs::AO_Philo1} $declare${AOs::AO_Philo2} $declare${AOs::AO_Philo3} $declare${AOs::AO_Philo4} $declare${AOs::AO_Table} $declare${AOs::Philo_ctor} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ $declare${AOs::Philo} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Philo0} $define${AOs::AO_Philo1} $define${AOs::AO_Philo2} $define${AOs::AO_Philo3} $define${AOs::AO_Philo4} /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo_ctor} $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/workstation/dpp/dpp.sln ================================================ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dpp", "dpp.vcxproj", "{8CC465F7-872E-4D03-B93C-1B64858B4E11}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.ActiveCfg = Debug|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.Build.0 = Debug|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.ActiveCfg = Release|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: examples/workstation/dpp/dpp.vcxproj ================================================  Debug Win32 Release Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11} dpp Win32Proj 10.0 Application NotSet true v142 Application NotSet v142 <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(Configuration)\ true $(SolutionDir)$(Configuration)\ $(Configuration)\ false Disabled .;../../../include;../../../ports/win32-qv WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) false Default MultiThreaded NotUsing Level4 ProgramDatabase 4127 Default %(AdditionalDependencies) %(AdditionalLibraryDirectories) true Console MachineX86 MaxSpeed true .;../../../include;../../../ports/win32-qv NDEBUG;snprintf=_snprintf;WIN32;_CONSOLE;%(PreprocessorDefinitions) false Default MultiThreaded true NotUsing Level4 ProgramDatabase 4127 %(AdditionalDependencies) %(AdditionalLibraryDirectories) true Console true true MachineX86 true ================================================ FILE: examples/workstation/dpp/dpp.vcxproj.filters ================================================  QP QP QP {a6390746-fe72-41ca-8497-373e88ccf529} ================================================ FILE: examples/workstation/dpp/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.8.0 * Date of the Last Update: 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_philoQueue[N_PHILO][N_PHILO]; static QEvt l_tableQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Philo0, l_philoQueue[0], Q_DIM(l_philoQueue[0]) }, { (QActive *)&AO_Philo1, l_philoQueue[1], Q_DIM(l_philoQueue[1]) }, { (QActive *)&AO_Philo2, l_philoQueue[2], Q_DIM(l_philoQueue[2]) }, { (QActive *)&AO_Philo3, l_philoQueue[3], Q_DIM(l_philoQueue[3]) }, { (QActive *)&AO_Philo4, l_philoQueue[4], Q_DIM(l_philoQueue[4]) }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Philo_ctor(); /* instantiate all Philo AOs */ Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/dpp/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QActive super; } Philo; /* protected: */ static QState Philo_initial(Philo * const me); static QState Philo_thinking(Philo * const me); static QState Philo_hungry(Philo * const me); static QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo0} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo0} .......................................................*/ struct Philo AO_Philo0; /*.$enddef${AOs::AO_Philo0} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo1} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo1} .......................................................*/ struct Philo AO_Philo1; /*.$enddef${AOs::AO_Philo1} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo2} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo2} .......................................................*/ struct Philo AO_Philo2; /*.$enddef${AOs::AO_Philo2} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo3} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo3} .......................................................*/ struct Philo AO_Philo3; /*.$enddef${AOs::AO_Philo3} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Philo4} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Philo4} .......................................................*/ struct Philo AO_Philo4; /*.$enddef${AOs::AO_Philo4} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$define${AOs::Philo_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo_ctor} ......................................................*/ void Philo_ctor(void) { QActive_ctor(&AO_Philo0.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo1.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo2.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo3.super, Q_STATE_CAST(&Philo_initial)); QActive_ctor(&AO_Philo4.super, Q_STATE_CAST(&Philo_initial)); BSP_randomSeed(123U); } /*.$enddef${AOs::Philo_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::SM} .......................................................*/ static QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ static QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, THINK_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ static QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ static QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { QActive_armX(&me->super, 0U, EAT_TIME, 0U); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->super.prio); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/dpp/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/dpp/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::TERMINATE} */ case TERMINATE_SIG: { BSP_terminate(0); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { QActive *philo; me->fork[LEFT(n)] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + n].act)); QACTIVE_POST(philo, EAT_SIG, n); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; QActive *philo; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; philo = QF_ACTIVE_CAST(Q_ROM_PTR(QF_active[PHILO_0_PRIO + m].act)); QACTIVE_POST(philo, EAT_SIG, m); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)(Q_PAR(me) - PHILO_0_PRIO); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/dpp-comp/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := dpp #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ philo.c \ table.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/dpp-comp/bsp.c ================================================ /***************************************************************************** * Product: DPP example (console) * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "dpp.h" #include "bsp.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /* local variables ---------------------------------------------------------*/ static uint32_t l_rnd; /* random seed */ /*..........................................................................*/ void BSP_init(void) { PRINTF_S("Dining Philosopher Problem example\n" "QP-nano %s\n" "Press 'p' to pause\n" "Press 's' to serve\n" "Press ESC to quit...\n", QP_VERSION_STR); BSP_randomSeed(1234U); } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; QF_stop(); } /*..........................................................................*/ void BSP_displayPhilStat(uint8_t n, char_t const *stat) { PRINTF_S("Philosopher %2d is %s\n", (int)n, stat); } /*..........................................................................*/ void BSP_displayPaused(uint8_t paused) { PRINTF_S("Paused is %s\n", paused ? "ON" : "OFF"); } /*..........................................................................*/ uint32_t BSP_random(void) { /* a very cheap pseudo-random-number generator */ /* "Super-Duper" Linear Congruential Generator (LCG) * LCG(2^32, 3*7*11*13*23, 0, seed) */ l_rnd = l_rnd * (3U*7U*11U*13U*23U); return l_rnd >> 8; } /*..........................................................................*/ void BSP_randomSeed(uint32_t seed) { l_rnd = seed; } /****************************************************************************/ /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const module, int_t id) { FPRINTF_S(stderr, "Assertion in %s:%d", module, id); BSP_terminate(-1); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case '\33': { /* see if the ESC key pressed */ BSP_terminate(0); break; } case 'p': { QACTIVE_POST_ISR((QActive *)&AO_Table, PAUSE_SIG, 0U); break; } case 's': { QACTIVE_POST_ISR((QActive *)&AO_Table, SERVE_SIG, 0U); break; } default: { break; } } } ================================================ FILE: examples/workstation/dpp-comp/bsp.h ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-03-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web : www.state-machine.com * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_displayPaused(uint8_t paused); void BSP_displayPhilStat(uint8_t n, char_t const *stat); void BSP_terminate(int16_t result); void BSP_randomSeed(uint32_t seed); /* random seed */ uint32_t BSP_random(void); /* pseudo-random generator */ #endif /* BSP_H */ ================================================ FILE: examples/workstation/dpp-comp/dpp.h ================================================ /*.$file${.::dpp.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp_comp.qm * File: ${.::dpp.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::dpp.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)10) /*.$declare${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ typedef struct Philo { /* protected: */ QHsm super; /* public: */ uint16_t tickCtr; uint8_t num; } Philo; /* public: */ void Philo_ctor(Philo * const me, uint8_t num); /* protected: */ QState Philo_initial(Philo * const me); QState Philo_thinking(Philo * const me); QState Philo_hungry(Philo * const me); QState Philo_eating(Philo * const me); /*.$enddecl${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ extern struct Table AO_Table; /*.$enddecl${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$declare${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void); /*.$enddecl${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* DPP_H */ ================================================ FILE: examples/workstation/dpp-comp/dpp.sln ================================================ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dpp", "dpp.vcxproj", "{8CC465F7-872E-4D03-B93C-1B64858B4E11}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.ActiveCfg = Debug|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Debug|Win32.Build.0 = Debug|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.ActiveCfg = Release|Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: examples/workstation/dpp-comp/dpp.vcxproj ================================================  Debug Win32 Release Win32 {8CC465F7-872E-4D03-B93C-1B64858B4E11} dpp Win32Proj 10.0 Application NotSet true v142 Application NotSet v142 <_ProjectFileVersion>10.0.40219.1 $(SolutionDir)$(Configuration)\ $(Configuration)\ true $(SolutionDir)$(Configuration)\ $(Configuration)\ false Disabled .;../../../include;../../../ports/win32-qv WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) false Default MultiThreaded NotUsing Level4 ProgramDatabase 4127 Default %(AdditionalDependencies) %(AdditionalLibraryDirectories) true Console MachineX86 MaxSpeed true .;../../../include;../../../ports/win32-qv NDEBUG;snprintf=_snprintf;WIN32;_CONSOLE;%(PreprocessorDefinitions) false Default MultiThreaded true NotUsing Level4 ProgramDatabase 4127 %(AdditionalDependencies) %(AdditionalLibraryDirectories) true Console true true MachineX86 true ================================================ FILE: examples/workstation/dpp-comp/dpp.vcxproj.filters ================================================  QP QP QP {a6390746-fe72-41ca-8497-373e88ccf529} ================================================ FILE: examples/workstation/dpp-comp/dpp_comp.qm ================================================ Dining Philosopher Problem (DPP) example with the "Orthogonal Component" state pattern. In this implemetnation, the Philosophers (Philos) are not active objects, but rather state-machine components of the Table active object. QHsm_ctor(&me->super, Q_STATE_CAST(&Philo_initial)); me->num = num; me->tickCtr = 0U; me->tickCtr = THINK_TIME; me->tickCtr = 0U; Q_ERROR(); /* these events should never arrive in this state */ QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->num); Q_ERROR(); /* this event should never arrive in this state */ me->tickCtr = EAT_TIME; me->tickCtr = 0U; QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->num); Q_ERROR(); /* these events should never arrive in this state */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { QHSM_INIT(&me->philo_pool[n].super); me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } // request periodic timeout in 1 clock tick and every 1 tick QActive_armX(&me->super, 0U, 1U, 1U); Q_ERROR(); uint8_t n; for (n = 0U; n < N_PHILO; ++n) { // for all "Philo" components... Philo *philo = &me->philo_pool[n]; if (philo->tickCtr != 0U) { // is the "Philo" tick counter runnning? if (--philo->tickCtr == 0U) { // is the "Philo" tick expiring? // synchronously dispatch to component Q_SIG(philo) = Q_TIMEOUT_SIG; Q_PAR(philo) = n; QHSM_DISPATCH(&philo->super); } } } uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { me->fork[LEFT(n)] = USED; me->fork[n] = USED; /* synchronously dispatch to philo_pool[n] */ Q_SIG(&me->philo_pool[n]) = EAT_SIG; Q_PAR(&me->philo_pool[n]) = n; QHSM_DISPATCH(&me->philo_pool[n].super); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } uint8_t n, m; n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); (me->fork[m] == FREE) && (me->fork[n] == FREE) me->fork[m] = USED; me->fork[n] = USED; /* synchronously dispatch to philo_pool[n] */ Q_SIG(&me->philo_pool[n]) = EAT_SIG; Q_PAR(&me->philo_pool[n]) = n; QHSM_DISPATCH(&me->philo_pool[n].super); BSP_displayPhilStat(n, "eating "); else me->isHungry[n] = 1U; uint8_t n, m; n = (uint8_t)Q_PAR(me); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Philo[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; /* synchronously dispatch to philo_pool[m] */ Q_SIG(&me->philo_pool[m]) = EAT_SIG; Q_PAR(&me->philo_pool[m]) = m; QHSM_DISPATCH(&me->philo_pool[m].super); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; /* synchronously dispatch to philo_pool[m] */ Q_SIG(&me->philo_pool[m]) = EAT_SIG; Q_PAR(&me->philo_pool[m]) = m; QHSM_DISPATCH(&me->philo_pool[m].super); BSP_displayPhilStat(m, "eating "); } Q_ERROR(); BSP_displayPaused(1U); BSP_displayPaused(0U); uint8_t n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); uint8_t n, m; n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { Philo_ctor(&me->philo_pool[n], n); me->fork[n] = FREE; me->isHungry[n] = 0U; } #ifndef DPP_H #define DPP_H enum DPPSignals { EAT_SIG = Q_USER_SIG, /* published by Table to let a philosopher eat */ DONE_SIG, /* published by Philosopher when done eating */ PAUSE_SIG, /* published by BSP to pause the application */ SERVE_SIG, /* published by BSP to pause the application */ TERMINATE_SIG, /* published by BSP to terminate the application */ HUNGRY_SIG, /* posted direclty to Table from hungry Philo */ MAX_SIG /* the last signal */ }; /* number of philosophers */ #define N_PHILO ((uint8_t)10) $declare${AOs::Philo} $declare${AOs::AO_Table} $declare${AOs::Table_ctor} #endif /* DPP_H */ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ $define${AOs::Philo} #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ $declare${AOs::Table} /* Global objects ----------------------------------------------------------*/ $define${AOs::AO_Table} #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ $define${AOs::Table_ctor} $define${AOs::Table} ================================================ FILE: examples/workstation/dpp-comp/main.c ================================================ /***************************************************************************** * Product: DPP example * Last Updated for Version: 5.9.8 * Date of the Last Update: 2017-09-19 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ /*..........................................................................*/ static QEvt l_tableQueue[10]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Table, l_tableQueue, Q_DIM(l_tableQueue) } }; /*..........................................................................*/ int_t main() { Table_ctor(); /* instantiate the Table AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/dpp-comp/philo.c ================================================ /*.$file${.::philo.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp_comp.qm * File: ${.::philo.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::philo.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("philo") /* Active object class -----------------------------------------------------*/ /* Local objects -----------------------------------------------------------*/ #define THINK_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + (BSP_TICKS_PER_SEC/2U)) #define EAT_TIME \ (QTimeEvtCtr)((BSP_random() % BSP_TICKS_PER_SEC) + BSP_TICKS_PER_SEC) /* Philo definition --------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Philo} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Philo} ...........................................................*/ /*.${AOs::Philo::ctor} .....................................................*/ void Philo_ctor(Philo * const me, uint8_t num) { QHsm_ctor(&me->super, Q_STATE_CAST(&Philo_initial)); me->num = num; } /*.${AOs::Philo::SM} .......................................................*/ QState Philo_initial(Philo * const me) { /*.${AOs::Philo::SM::initial} */ me->tickCtr = 0U; return Q_TRAN(&Philo_thinking); } /*.${AOs::Philo::SM::thinking} .............................................*/ QState Philo_thinking(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::thinking} */ case Q_ENTRY_SIG: { me->tickCtr = THINK_TIME; status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking} */ case Q_EXIT_SIG: { me->tickCtr = 0U; status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::thinking::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_hungry); break; } /*.${AOs::Philo::SM::thinking::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::hungry} ...............................................*/ QState Philo_hungry(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::hungry} */ case Q_ENTRY_SIG: { QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->num); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::hungry::EAT} */ case EAT_SIG: { status_ = Q_TRAN(&Philo_eating); break; } /*.${AOs::Philo::SM::hungry::DONE} */ case DONE_SIG: { Q_ERROR(); /* this event should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Philo::SM::eating} ...............................................*/ QState Philo_eating(Philo * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Philo::SM::eating} */ case Q_ENTRY_SIG: { me->tickCtr = EAT_TIME; status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating} */ case Q_EXIT_SIG: { me->tickCtr = 0U; QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->num); status_ = Q_HANDLED(); break; } /*.${AOs::Philo::SM::eating::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Philo_thinking); break; } /*.${AOs::Philo::SM::eating::EAT, DONE} */ case EAT_SIG: /* intentionally fall through */ case DONE_SIG: { Q_ERROR(); /* these events should never arrive in this state */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${AOs::Philo} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/dpp-comp/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the Blinky example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/dpp-comp/table.c ================================================ /*.$file${.::table.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: dpp_comp.qm * File: ${.::table.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::table.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano port */ #include "bsp.h" /* Board Support Package */ #include "dpp.h" /* Application interface */ Q_DEFINE_THIS_MODULE("table") /* Active object class -----------------------------------------------------*/ /*.$declare${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ typedef struct Table { /* protected: */ QActive super; /* private: */ Philo philo_pool[N_PHILO]; uint8_t fork[N_PHILO]; uint8_t isHungry[N_PHILO]; } Table; /* protected: */ static QState Table_initial(Table * const me); static QState Table_active(Table * const me); static QState Table_serving(Table * const me); static QState Table_paused(Table * const me); /*.$enddecl${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::AO_Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::AO_Table} ........................................................*/ struct Table AO_Table; /*.$enddef${AOs::AO_Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #define RIGHT(n_) ((uint8_t)(((n_) + (N_PHILO - 1U)) % N_PHILO)) #define LEFT(n_) ((uint8_t)(((n_) + 1U) % N_PHILO)) #define FREE ((uint8_t)0) #define USED ((uint8_t)1) /*..........................................................................*/ /*.$define${AOs::Table_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table_ctor} ......................................................*/ void Table_ctor(void) { uint8_t n; Table *me = &AO_Table; QActive_ctor(&me->super, Q_STATE_CAST(&Table_initial)); for (n = 0U; n < N_PHILO; ++n) { Philo_ctor(&me->philo_pool[n], n); me->fork[n] = FREE; me->isHungry[n] = 0U; } } /*.$enddef${AOs::Table_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${AOs::Table} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${AOs::Table} ...........................................................*/ /*.${AOs::Table::SM} .......................................................*/ static QState Table_initial(Table * const me) { /*.${AOs::Table::SM::initial} */ uint8_t n; for (n = 0U; n < N_PHILO; ++n) { QHSM_INIT(&me->philo_pool[n].super); me->fork[n] = FREE; me->isHungry[n] = 0U; BSP_displayPhilStat(n, "thinking"); } return Q_TRAN(&Table_serving); } /*.${AOs::Table::SM::active} ...............................................*/ static QState Table_active(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active} */ case Q_ENTRY_SIG: { // request periodic timeout in 1 clock tick and every 1 tick QActive_armX(&me->super, 0U, 1U, 1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { // for all "Philo" components... Philo *philo = &me->philo_pool[n]; if (philo->tickCtr != 0U) { // is the "Philo" tick counter runnning? if (--philo->tickCtr == 0U) { // is the "Philo" tick expiring? // synchronously dispatch to component Q_SIG(philo) = Q_TIMEOUT_SIG; Q_PAR(philo) = n; QHSM_DISPATCH(&philo->super); } } } status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${AOs::Table::SM::active::serving} ......................................*/ static QState Table_serving(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::serving} */ case Q_ENTRY_SIG: { uint8_t n; for (n = 0U; n < N_PHILO; ++n) { /* give permissions to eat... */ if ((me->isHungry[n] != 0U) && (me->fork[LEFT(n)] == FREE) && (me->fork[n] == FREE)) { me->fork[LEFT(n)] = USED; me->fork[n] = USED; /* synchronously dispatch to philo_pool[n] */ Q_SIG(&me->philo_pool[n]) = EAT_SIG; Q_PAR(&me->philo_pool[n]) = n; QHSM_DISPATCH(&me->philo_pool[n].super); me->isHungry[n] = 0U; BSP_displayPhilStat(n, "eating "); } } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::HUNGRY} */ case HUNGRY_SIG: { uint8_t n, m; n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "hungry "); m = LEFT(n); /*.${AOs::Table::SM::active::serving::HUNGRY::[bothfree]} */ if ((me->fork[m] == FREE) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; /* synchronously dispatch to philo_pool[n] */ Q_SIG(&me->philo_pool[n]) = EAT_SIG; Q_PAR(&me->philo_pool[n]) = n; QHSM_DISPATCH(&me->philo_pool[n].super); BSP_displayPhilStat(n, "eating "); status_ = Q_HANDLED(); } /*.${AOs::Table::SM::active::serving::HUNGRY::[else]} */ else { me->isHungry[n] = 1U; status_ = Q_HANDLED(); } break; } /*.${AOs::Table::SM::active::serving::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)Q_PAR(me); /* phil ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Philo[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; m = RIGHT(n); /* check the right neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[m] == FREE)) { me->fork[n] = USED; me->fork[m] = USED; me->isHungry[m] = 0U; /* synchronously dispatch to philo_pool[m] */ Q_SIG(&me->philo_pool[m]) = EAT_SIG; Q_PAR(&me->philo_pool[m]) = m; QHSM_DISPATCH(&me->philo_pool[m].super); BSP_displayPhilStat(m, "eating "); } m = LEFT(n); /* check the left neighbor */ n = LEFT(m); /* left fork of the left neighbor */ if ((me->isHungry[m] != 0U) && (me->fork[n] == FREE)) { me->fork[m] = USED; me->fork[n] = USED; me->isHungry[m] = 0U; /* synchronously dispatch to philo_pool[m] */ Q_SIG(&me->philo_pool[m]) = EAT_SIG; Q_PAR(&me->philo_pool[m]) = m; QHSM_DISPATCH(&me->philo_pool[m].super); BSP_displayPhilStat(m, "eating "); } status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::EAT} */ case EAT_SIG: { Q_ERROR(); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::serving::PAUSE} */ case PAUSE_SIG: { status_ = Q_TRAN(&Table_paused); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.${AOs::Table::SM::active::paused} .......................................*/ static QState Table_paused(Table * const me) { QState status_; switch (Q_SIG(me)) { /*.${AOs::Table::SM::active::paused} */ case Q_ENTRY_SIG: { BSP_displayPaused(1U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused} */ case Q_EXIT_SIG: { BSP_displayPaused(0U); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::SERVE} */ case SERVE_SIG: { status_ = Q_TRAN(&Table_serving); break; } /*.${AOs::Table::SM::active::paused::HUNGRY} */ case HUNGRY_SIG: { uint8_t n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); me->isHungry[n] = 1U; BSP_displayPhilStat(n, "hungry "); status_ = Q_HANDLED(); break; } /*.${AOs::Table::SM::active::paused::DONE} */ case DONE_SIG: { uint8_t n, m; n = (uint8_t)Q_PAR(me); /* philo ID must be in range and he must be not hungry */ Q_ASSERT((n < N_PHILO) && (me->isHungry[n] == 0U)); BSP_displayPhilStat(n, "thinking"); m = LEFT(n); /* both forks of Phil[n] must be used */ Q_ASSERT((me->fork[n] == USED) && (me->fork[m] == USED)); me->fork[m] = FREE; me->fork[n] = FREE; status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&Table_active); break; } } return status_; } /*.$enddef${AOs::Table} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/dpp-gui/README.txt ================================================ The Win32 GUI emulation of the Dining Philosopers Problem (DPP) example for the EFM32-SLSTK3401A board from Silicon Labs is now located in the directory: examples\arm-cm\dpp_efm32-slstk3401a\win32-gui\ This co-location of the Win32 emulation with the embedded code running on the actual board demonstrates better the "dual targeting" development approach. ================================================ FILE: examples/workstation/game-gui/README.txt ================================================ The Win32 GUI emulation of the "Fly 'n' Shoot" game example for the EFM32-SLSTK3401A board from Silicon Labs is now located in the directory: examples\arm-cm\game_efm32-slstk3401a\win32-gui\ **** NOTE: The EFM32-SLSTK3401A board replaces the EK-LM3S811 board, which has been discontinued. **** This co-location of the Win32 emulation with the embedded code running on the actual board demonstrates better the "dual targeting" development approach. ================================================ FILE: examples/workstation/history/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := history #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ history.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/history/bsp.c ================================================ /***************************************************************************** * Product: Board Support Package (BSP) for the History example * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "history.h" /* Application interface */ #include "safe_std.h" /* portable "safe" / facilities */ #include /*..........................................................................*/ /* dummy definition of the QF_active[] array (not used in this example) */ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U } }; /*..........................................................................*/ void BSP_init(void) { PRINTF_S("History state pattern\nQP-nano version: %s\n" "Press 'o' to OPEN the door\n" "Press 'c' to CLOSE the door\n" "Press 't' to start TOASTING\n" "Press 'b' to start BAKING\n" "Press 'f' to turn the oven OFF\n" "Press ESC to quit...\n", QP_VERSION_STR); } /*..........................................................................*/ void BSP_exit(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_onCleanup(); exit(0); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { } /*..........................................................................*/ /* this function is used by the QP embedded systems-friendly assertions */ Q_NORETURN Q_onAssert(char const * const file, int line) { PRINTF_S("Assertion failed in %s, line %d", file, line); exit(-1); } ================================================ FILE: examples/workstation/history/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_exit(void); #endif /* BSP_H */ ================================================ FILE: examples/workstation/history/history.c ================================================ /*.$file${.::history.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: history.qm * File: ${.::history.c} * * This code has been generated by QM 5.0.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::history.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "history.h" /* Application interface */ #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*.$declare${SMs::ToastOven} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::ToastOven} .......................................................*/ typedef struct ToastOven { /* protected: */ QHsm super; /* private state histories */ QStateHandler hist_doorClosed; } ToastOven; /* protected: */ static QState ToastOven_initial(ToastOven * const me); static QState ToastOven_doorClosed(ToastOven * const me); static QState ToastOven_heating(ToastOven * const me); static QState ToastOven_toasting(ToastOven * const me); static QState ToastOven_baking(ToastOven * const me); static QState ToastOven_off(ToastOven * const me); static QState ToastOven_doorOpen(ToastOven * const me); static QState ToastOven_final(ToastOven * const me); /*.$enddecl${SMs::ToastOven} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ static ToastOven l_oven; /* the only instance of the ToastOven class */ /* global-scope definitions -----------------------------------------*/ QHsm * const the_oven = (QHsm *)&l_oven; /* the opaque pointer */ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 670U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.7.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${SMs::ToastOven_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::ToastOven_ctor} ..................................................*/ void ToastOven_ctor(void) { ToastOven *me = &l_oven; QHsm_ctor(&me->super, Q_STATE_CAST(&ToastOven_initial)); } /*.$enddef${SMs::ToastOven_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${SMs::ToastOven} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::ToastOven} .......................................................*/ /*.${SMs::ToastOven::SM} ...................................................*/ static QState ToastOven_initial(ToastOven * const me) { /*.${SMs::ToastOven::SM::initial} */ /* state history attributes */ /* state history attributes */ me->hist_doorClosed = Q_STATE_CAST(&ToastOven_off); return Q_TRAN(&ToastOven_doorClosed); } /*.${SMs::ToastOven::SM::doorClosed} .......................................*/ static QState ToastOven_doorClosed(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorClosed} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "door-Closed"); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorClosed} */ case Q_EXIT_SIG: { /* save deep history */ me->hist_doorClosed = QHsm_state(me); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorClosed::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&ToastOven_off); break; } /*.${SMs::ToastOven::SM::doorClosed::TERMINATE} */ case TERMINATE_SIG: { status_ = Q_TRAN(&ToastOven_final); break; } /*.${SMs::ToastOven::SM::doorClosed::OPEN} */ case OPEN_SIG: { status_ = Q_TRAN(&ToastOven_doorOpen); break; } /*.${SMs::ToastOven::SM::doorClosed::TOAST} */ case TOAST_SIG: { status_ = Q_TRAN(&ToastOven_toasting); break; } /*.${SMs::ToastOven::SM::doorClosed::BAKE} */ case BAKE_SIG: { status_ = Q_TRAN(&ToastOven_baking); break; } /*.${SMs::ToastOven::SM::doorClosed::OFF} */ case OFF_SIG: { status_ = Q_TRAN(&ToastOven_off); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${SMs::ToastOven::SM::doorClosed::heating} ..............................*/ static QState ToastOven_heating(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorClosed::heating} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "heater-On"); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorClosed::heating} */ case Q_EXIT_SIG: { PRINTF_S("%s;", "heater-Off"); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorClosed::heating::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&ToastOven_toasting); break; } default: { status_ = Q_SUPER(&ToastOven_doorClosed); break; } } return status_; } /*.${SMs::ToastOven::SM::doorClosed::heating::toasting} ....................*/ static QState ToastOven_toasting(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorClosed::heating::toasting} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "toasting"); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&ToastOven_heating); break; } } return status_; } /*.${SMs::ToastOven::SM::doorClosed::heating::baking} ......................*/ static QState ToastOven_baking(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorClosed::heating::baking} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "baking"); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&ToastOven_heating); break; } } return status_; } /*.${SMs::ToastOven::SM::doorClosed::off} ..................................*/ static QState ToastOven_off(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorClosed::off} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "toaster-Off"); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&ToastOven_doorClosed); break; } } return status_; } /*.${SMs::ToastOven::SM::doorOpen} .........................................*/ static QState ToastOven_doorOpen(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::doorOpen} */ case Q_ENTRY_SIG: { PRINTF_S("%s;", "door-Open,lamp-On"); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorOpen} */ case Q_EXIT_SIG: { PRINTF_S("%s;", "lamp-Off"); status_ = Q_HANDLED(); break; } /*.${SMs::ToastOven::SM::doorOpen::CLOSE} */ case CLOSE_SIG: { status_ = Q_TRAN_HIST(me->hist_doorClosed); break; } /*.${SMs::ToastOven::SM::doorOpen::TERMINATE} */ case TERMINATE_SIG: { status_ = Q_TRAN(&ToastOven_final); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${SMs::ToastOven::SM::final} ............................................*/ static QState ToastOven_final(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*.${SMs::ToastOven::SM::final} */ case Q_ENTRY_SIG: { BSP_exit(); /* terminate the application */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${SMs::ToastOven} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/history/history.h ================================================ /*.$file${.::history.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: history.qm * File: ${.::history.h} * * This code has been generated by QM 5.0.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::history.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef HISTORY_H #define HISTORY_H enum ToastOvenSignals { OPEN_SIG = Q_USER_SIG, CLOSE_SIG, TOAST_SIG, BAKE_SIG, OFF_SIG, TERMINATE_SIG /* terminate the application */ }; extern QHsm * const the_oven; /* opaque pointer to the oven HSM */ /*.$declare${SMs::ToastOven_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${SMs::ToastOven_ctor} ..................................................*/ void ToastOven_ctor(void); /*.$enddecl${SMs::ToastOven_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* HISTORY_H */ ================================================ FILE: examples/workstation/history/history.qm ================================================ QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. Oven state machine PRINTF_S("%s;", "door-Closed"); PRINTF_S("%s;", "heater-On"); PRINTF_S("%s;", "heater-Off"); PRINTF_S("%s;", "toasting"); PRINTF_S("%s;", "baking"); PRINTF_S("%s;", "toaster-Off"); PRINTF_S("%s;", "door-Open,lamp-On"); PRINTF_S("%s;", "lamp-Off"); BSP_exit(); /* terminate the application */ ToastOven *me = &l_oven; QHsm_ctor(&me->super, Q_STATE_CAST(&ToastOven_initial)); #ifndef HISTORY_H #define HISTORY_H enum ToastOvenSignals { OPEN_SIG = Q_USER_SIG, CLOSE_SIG, TOAST_SIG, BAKE_SIG, OFF_SIG, TERMINATE_SIG /* terminate the application */ }; extern QHsm * const the_oven; /* opaque pointer to the oven HSM */ $declare(SMs::ToastOven_ctor) #endif /* HISTORY_H */ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "history.h" /* Application interface */ #include "safe_std.h" /* portable "safe" <stdio.h>/<string.h> facilities */ #include <stdlib.h> //Q_DEFINE_THIS_FILE $declare(SMs::ToastOven) static ToastOven l_oven; /* the only instance of the ToastOven class */ /* global-scope definitions -----------------------------------------*/ QHsm * const the_oven = (QHsm *)&l_oven; /* the opaque pointer */ $define(SMs::ToastOven_ctor) $define(SMs::ToastOven) ================================================ FILE: examples/workstation/history/main.c ================================================ /***************************************************************************** * Product: History Example for QP-nano, Win32 * Last updated for version 6.4.0 * Last updated on 2019-02-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package */ #include "history.h" /* Application interface */ #include "safe_std.h" /* portable "safe" / facilities */ #include Q_DEFINE_THIS_FILE /*..........................................................................*/ int main() { QF_onStartup(); ToastOven_ctor(); /* instantiate the ToasterOven object */ BSP_init(); /* initialize the Board Support Package */ QHSM_INIT(the_oven); /* trigger the initial transition */ for (;;) { uint8_t c; PRINTF_S("%c\n", ' '); c = (uint8_t)QF_consoleWaitForKey(); PRINTF_S("%c: ", (c != '\33') ? c : 'x'); switch (c) { case 'o': Q_SIG(the_oven) = OPEN_SIG; break; case 'c': Q_SIG(the_oven) = CLOSE_SIG; break; case 't': Q_SIG(the_oven) = TOAST_SIG; break; case 'b': Q_SIG(the_oven) = BAKE_SIG; break; case 'f': Q_SIG(the_oven) = OFF_SIG; break; case '\33': Q_SIG(the_oven) = TERMINATE_SIG; break; } /* dispatch the event into the state machine */ QHSM_DISPATCH(the_oven); } QF_onCleanup(); return 0; } ================================================ FILE: examples/workstation/history/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the "Tranisition to History" example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define QF_TIMEEVT_CTR_SIZE 2U #define Q_PARAM_SIZE 4U #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/pelican/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := pelican #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ pelican.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/pelican/bsp.c ================================================ /***************************************************************************** * Product: BSP for PELICAN crossing example, Win32-GUI * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-11-09 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_MODULE("bsp") /*..........................................................................*/ void BSP_init(void) { PRINTF_S("Pedestrian LIght CONtrolled crossing example" "\nQP-nano %s\n" "Press 'p' to generate PED_WAITING\n" "Press 'f' to generate OFF\n" "Press 'o' to generate ON\n" "Press ESC to quit...\n", QP_VERSION_STR); } /*..........................................................................*/ void BSP_terminate(int16_t result) { (void)result; QF_stop(); } /*..........................................................................*/ void BSP_showState(char_t const *state) { PRINTF_S("STATE: %s -----\n", state); } /*..........................................................................*/ void BSP_signalCars(enum BSP_CarsSignal sig) { switch (sig) { case CARS_RED: { PRINTF_S("%s\n", "cars: RED"); break; } case CARS_YELLOW: { PRINTF_S("%s\n", "cars: YELLOW"); break; } case CARS_GREEN: { PRINTF_S("%s\n", "cars: GREEN"); break; } case CARS_BLANK: { PRINTF_S("%s\n", "cars: BLANK"); break; } } } /*..........................................................................*/ void BSP_signalPeds(enum BSP_PedsSignal sig) { switch (sig) { case PEDS_DONT_WALK: { PRINTF_S("%s\n", "peds: DON'T WALK"); break; } case PEDS_BLANK: { PRINTF_S("%s\n", "peds: BLANK"); break; } case PEDS_WALK: { PRINTF_S("%s\n", "peds: WALK"); break; } } } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case 'p': PRINTF_S("%s\n", "-----> PEDS_WAITING"); QACTIVE_POST_ISR((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0U); break; case 'f': PRINTF_S("%s\n", "-----> OFF"); QACTIVE_POST_ISR((QActive *)&AO_Pelican, OFF_SIG, 0U); break; case 'o': PRINTF_S("%s\n", "-----> ON"); QACTIVE_POST_ISR((QActive *)&AO_Pelican, ON_SIG, 0U); break; case '\33': /* ESC pressed? */ QACTIVE_POST_ISR((QActive *)&AO_Pelican, TERMINATE_SIG, 0U); break; default: break; } } /*--------------------------------------------------------------------------*/ Q_NORETURN Q_onAssert(char const * const module, int location) { QF_INT_DISABLE(); /* cut-off all interrupts */ FPRINTF_S(stderr, "Assertion failed in %s:%d", module, location); BSP_terminate(-1); } ================================================ FILE: examples/workstation/pelican/bsp.h ================================================ /***************************************************************************** * Product: BSP for PELICAN crossing example * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U enum BSP_CarsSignal { CARS_RED, CARS_YELLOW, CARS_GREEN, CARS_BLANK }; enum BSP_PedsSignal { PEDS_DONT_WALK, PEDS_WALK, PEDS_BLANK }; void BSP_init(void); void BSP_showState(char_t const *state); void BSP_signalCars(enum BSP_CarsSignal sig); void BSP_signalPeds(enum BSP_PedsSignal sig); #endif /* BSP_H */ ================================================ FILE: examples/workstation/pelican/main.c ================================================ /***************************************************************************** * Product: PELICAN crossing example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*..........................................................................*/ static QEvt l_pelicanQueue[3]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Pelican, l_pelicanQueue, Q_DIM(l_pelicanQueue) } }; /*..........................................................................*/ int main (void) { Pelican_ctor(); /* instantiate the Pelican AO */ QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/pelican/pelican.c ================================================ /*.$file${.::pelican.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ /*.$declare${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ typedef struct Pelican { /* protected: */ QActive super; /* private: */ uint8_t flashCtr; } Pelican; /* protected: */ static QState Pelican_initial(Pelican * const me); static QState Pelican_operational(Pelican * const me); static QState Pelican_carsEnabled(Pelican * const me); static QState Pelican_carsGreen(Pelican * const me); static QState Pelican_carsGreenNoPed(Pelican * const me); static QState Pelican_carsGreenInt(Pelican * const me); static QState Pelican_carsGreenPedWait(Pelican * const me); static QState Pelican_carsYellow(Pelican * const me); static QState Pelican_pedsEnabled(Pelican * const me); static QState Pelican_pedsWalk(Pelican * const me); static QState Pelican_pedsFlash(Pelican * const me); static QState Pelican_offline(Pelican * const me); /*.$enddecl${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void) { QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); } /*.$enddef${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${components::Pelican} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican} ..................................................*/ /*.${components::Pelican::SM} ..............................................*/ static QState Pelican_initial(Pelican * const me) { /*.${components::Pelican::SM::initial} */ return Q_TRAN(&Pelican_operational); } /*.${components::Pelican::SM::operational} .................................*/ static QState Pelican_operational(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsEnabled); break; } /*.${components::Pelican::SM::operational::OFF} */ case OFF_SIG: { status_ = Q_TRAN(&Pelican_offline); break; } /*.${components::Pelican::SM::operational::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled} ....................*/ static QState Pelican_carsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled} */ case Q_EXIT_SIG: { BSP_signalCars(CARS_RED); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreen); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} .........*/ static QState Pelican_carsGreen(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_ENTRY_SIG: { BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenNoPed); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ static QState Pelican_carsGreenNoPed(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenNoPed"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsGreenPedWait); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenNoPed::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsGreenInt); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ static QState Pelican_carsGreenInt(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenInt"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenInt::PEDS_WAITING} */ case PEDS_WAITING_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ static QState Pelican_carsGreenPedWait(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait} */ case Q_ENTRY_SIG: { BSP_showState("carsGreenPedWait"); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsGreen::carsGreenPedWait::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_carsYellow); break; } default: { status_ = Q_SUPER(&Pelican_carsGreen); break; } } return status_; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} ........*/ static QState Pelican_carsYellow(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_ENTRY_SIG: { BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::carsEnabled::carsYellow::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsEnabled); break; } default: { status_ = Q_SUPER(&Pelican_carsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled} ....................*/ static QState Pelican_pedsEnabled(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled} */ case Q_EXIT_SIG: { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::initial} */ case Q_INIT_SIG: { status_ = Q_TRAN(&Pelican_pedsWalk); break; } default: { status_ = Q_SUPER(&Pelican_operational); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} ..........*/ static QState Pelican_pedsWalk(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_ENTRY_SIG: { BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsWalk::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { status_ = Q_TRAN(&Pelican_pedsFlash); break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} .........*/ static QState Pelican_pedsFlash(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_ENTRY_SIG: { BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0U]} */ if (me->flashCtr != 0U) { --me->flashCtr; /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[me->flashCtr!=0~::[else]} */ else { BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } } /*.${components::Pelican::SM::operational::pedsEnabled::pedsFlash::Q_TIMEOUT::[else]} */ else { status_ = Q_TRAN(&Pelican_carsEnabled); } break; } default: { status_ = Q_SUPER(&Pelican_pedsEnabled); break; } } return status_; } /*.${components::Pelican::SM::offline} .....................................*/ static QState Pelican_offline(Pelican * const me) { QState status_; switch (Q_SIG(me)) { /*.${components::Pelican::SM::offline} */ case Q_ENTRY_SIG: { BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline} */ case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status_ = Q_HANDLED(); break; } /*.${components::Pelican::SM::offline::Q_TIMEOUT} */ case Q_TIMEOUT_SIG: { me->flashCtr ^= 1U; /*.${components::Pelican::SM::offline::Q_TIMEOUT::[(me->flashCtr&1U)==0U]} */ if ((me->flashCtr & 1U) == 0U) { BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); status_ = Q_HANDLED(); } /*.${components::Pelican::SM::offline::Q_TIMEOUT::[else]} */ else { BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); status_ = Q_HANDLED(); } break; } /*.${components::Pelican::SM::offline::ON} */ case ON_SIG: { status_ = Q_TRAN(&Pelican_operational); break; } /*.${components::Pelican::SM::offline::TERMINATE} */ case TERMINATE_SIG: { QF_stop(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.$enddef${components::Pelican} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/pelican/pelican.h ================================================ /*.$file${.::pelican.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: pelican.qm * File: ${.::pelican.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::pelican.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ /*.$declare${components::Pelican_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${components::Pelican_ctor} .............................................*/ void Pelican_ctor(void); /*.$enddecl${components::Pelican_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ ================================================ FILE: examples/workstation/pelican/pelican.qm ================================================ PEdestrian LIght CONtrolled (PELICAN) crossing example PEdestrian LIght CONtrolled (PELICAN) crossing BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); QF_stop(); BSP_signalCars(CARS_RED); BSP_signalCars(CARS_GREEN); /* one-shot timeout in CARS_GREEN_MIN_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_GREEN_MIN_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("carsGreenNoPed"); BSP_showState("carsGreenInt"); BSP_showState("carsGreenPedWait"); BSP_showState("carsYellow"); BSP_signalCars(CARS_YELLOW); /* one-shot timeout in CARS_YELLOW_TOUT ticks */ QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_signalPeds(PEDS_DONT_WALK); BSP_showState("pedsWalk"); BSP_signalPeds(PEDS_WALK); /* one-shot timeout in PEDS_WALK_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_WALK_TOUT, 0U); QActive_disarmX(&me->super, 0U); BSP_showState("pedsFlash"); /* periodic timeout in PEDS_FLASH_TOUT and every PEDS_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT, PEDS_FLASH_TOUT); me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U; QActive_disarmX(&me->super, 0U); me->flashCtr != 0U --me->flashCtr; (me->flashCtr & 1U) == 0U BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalPeds(PEDS_BLANK); else BSP_showState("offline"); /* periodic timeout in OFF_FLASH_TOUT and every OFF_FLASH_TOUT ticks */ QActive_armX(&me->super, 0U, OFF_FLASH_TOUT, OFF_FLASH_TOUT); me->flashCtr = 0U; QActive_disarmX(&me->super, 0U); me->flashCtr ^= 1U; (me->flashCtr & 1U) == 0U BSP_signalCars(CARS_RED); BSP_signalPeds(PEDS_DONT_WALK); else BSP_signalCars(CARS_BLANK); BSP_signalPeds(PEDS_BLANK); QF_stop(); constructor QActive_ctor(&AO_Pelican.super, Q_STATE_CAST(&Pelican_initial)); #ifndef PELICAN_H #define PELICAN_H enum PelicanSignals { PEDS_WAITING_SIG = Q_USER_SIG, OFF_SIG, ON_SIG, TERMINATE_SIG }; /* active objects ................................................*/ $declare(components::Pelican_ctor) extern struct Pelican AO_Pelican; #endif /* PELICAN_H */ #include "qpn.h" /* QP-nano */ #include "bsp.h" /* Board Support Package (BSP) */ #include "pelican.h" /* application interface */ /*Q_DEFINE_THIS_FILE*/ #define CARS_GREEN_MIN_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 8U) #define CARS_YELLOW_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_WALK_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC * 3U) #define PEDS_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 5U) #define PEDS_FLASH_NUM (uint8_t)(5U * 2U) #define OFF_FLASH_TOUT (QTimeEvtCtr)(BSP_TICKS_PER_SEC / 2U) /* Pelican class declaration -----------------------------------------------*/ $declare(components::Pelican) /* Global objects ----------------------------------------------------------*/ struct Pelican AO_Pelican; /* the single instance of the Pelican AO */ /* Pelican class definition ------------------------------------------------*/ $define(components::Pelican_ctor) $define(components::Pelican) ================================================ FILE: examples/workstation/pelican/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the PELICAN example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_MAX_TICK_RATE 1U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/qhsmtst/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := qhsmtst #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ qhsmtst.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/qhsmtst/bsp.c ================================================ /***************************************************************************** * Product: BSP for QHsmTst example, Win32 * Last updated for version 6.4.0 * Last updated on 2019-02-10 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "qhsmtst.h" #include "safe_std.h" /* portable "safe" / facilities */ #include Q_DEFINE_THIS_FILE /*..........................................................................*/ /* dummy definition of the QF_active[] array (not used in this example) */ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U } }; static FILE *l_outFile; /*..........................................................................*/ void BSP_init(char const *fname) { if (*fname == '\0') { l_outFile = stdout; /* use the stdout as the output file */ PRINTF_S("QHsmTst example, built on %s at %s,\n" "QP-nano: %s.\nPress ESC to quit...\n", __DATE__, __TIME__, QP_VERSION_STR); } else { l_outFile = fopen(fname, "w"); Q_ASSERT(l_outFile != (FILE *)0); PRINTF_S("QHsmTst example, built on %s at %s, QP-nano %s\n" "output saved to %s\n", __DATE__, __TIME__, QP_VERSION_STR, fname); FPRINTF_S(l_outFile, "QHsmTst example, QP-nano %s\n", QP_VERSION_STR); } QHSM_INIT(the_hsm); /* the top-most initial tran. */ } /*..........................................................................*/ void BSP_exit(void) { fclose(l_outFile); PRINTF_S("\n%s\n", "Bye! Bye!"); QF_onCleanup(); exit(0); } /*..........................................................................*/ void BSP_display(char const *msg) { FPRINTF_S(l_outFile, "%s", msg); } /*..........................................................................*/ void BSP_dispatch(QSignal sig) { if ((A_SIG <= sig) && (sig <= I_SIG)) { FPRINTF_S(l_outFile, "%c:", 'A' + sig - A_SIG); } Q_SIG(the_hsm) = sig; QHSM_DISPATCH(the_hsm); /* dispatch the event */ FPRINTF_S(l_outFile, "\n", ""); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); } /*..........................................................................*/ void QF_onCleanup(void) { QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { } /*..........................................................................*/ /* this function is used by the QP embedded systems-friendly assertions */ Q_NORETURN Q_onAssert(char const * const file, int line) { PRINTF_S("Assertion failed in %s, line %d", file, line); exit(-1); } ================================================ FILE: examples/workstation/qhsmtst/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last updated for version 5.4.0 * Last updated on 2015-05-18 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, www.state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H void BSP_init(char const *fname); void BSP_exit(void); void BSP_display(char const *msg); void BSP_dispatch(QSignal sig); #endif /* BSP_H */ ================================================ FILE: examples/workstation/qhsmtst/log.txt ================================================ QHsmTst example, QP-nano 6.5.0 top-INIT;s-ENTRY;s2-ENTRY;s2-INIT;s21-ENTRY;s211-ENTRY;A:s21-A;s211-EXIT;s21-EXIT;s21-ENTRY;s21-INIT;s211-ENTRY; B:s21-B;s211-EXIT;s211-ENTRY; D:s211-D;s211-EXIT;s21-INIT;s211-ENTRY; E:s-E;s211-EXIT;s21-EXIT;s2-EXIT;s1-ENTRY;s11-ENTRY; I:s1-I; F:s1-F;s11-EXIT;s1-EXIT;s2-ENTRY;s21-ENTRY;s211-ENTRY; I:s2-I; I:s-I; F:s2-F;s211-EXIT;s21-EXIT;s2-EXIT;s1-ENTRY;s11-ENTRY; A:s1-A;s11-EXIT;s1-EXIT;s1-ENTRY;s1-INIT;s11-ENTRY; B:s1-B;s11-EXIT;s11-ENTRY; D:s1-D;s11-EXIT;s1-EXIT;s-INIT;s1-ENTRY;s11-ENTRY; D:s11-D;s11-EXIT;s1-INIT;s11-ENTRY; E:s-E;s11-EXIT;s1-EXIT;s1-ENTRY;s11-ENTRY; G:s11-G;s11-EXIT;s1-EXIT;s2-ENTRY;s21-ENTRY;s211-ENTRY; H:s211-H;s211-EXIT;s21-EXIT;s2-EXIT;s-INIT;s1-ENTRY;s11-ENTRY; H:s11-H;s11-EXIT;s1-EXIT;s-INIT;s1-ENTRY;s11-ENTRY; C:s1-C;s11-EXIT;s1-EXIT;s2-ENTRY;s2-INIT;s21-ENTRY;s211-ENTRY; G:s21-G;s211-EXIT;s21-EXIT;s2-EXIT;s1-ENTRY;s1-INIT;s11-ENTRY; C:s1-C;s11-EXIT;s1-EXIT;s2-ENTRY;s2-INIT;s21-ENTRY;s211-ENTRY; C:s2-C;s211-EXIT;s21-EXIT;s2-EXIT;s1-ENTRY;s1-INIT;s11-ENTRY; ================================================ FILE: examples/workstation/qhsmtst/main.c ================================================ /***************************************************************************** * Product: QHsmTst Example * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "qhsmtst.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*..........................................................................*/ int main(int argc, char *argv[]) { QHsmTst_ctor(); /* instantiate the QHsmTst object */ BSP_init((argc > 1) ? argv[1] : ""); QF_onStartup(); if (argc > 1) { /* batch version? */ /* testing of dynamic transitions... */ BSP_dispatch(A_SIG); BSP_dispatch(B_SIG); BSP_dispatch(D_SIG); BSP_dispatch(E_SIG); BSP_dispatch(I_SIG); BSP_dispatch(F_SIG); BSP_dispatch(I_SIG); BSP_dispatch(I_SIG); BSP_dispatch(F_SIG); BSP_dispatch(A_SIG); BSP_dispatch(B_SIG); BSP_dispatch(D_SIG); BSP_dispatch(D_SIG); BSP_dispatch(E_SIG); BSP_dispatch(G_SIG); BSP_dispatch(H_SIG); BSP_dispatch(H_SIG); BSP_dispatch(C_SIG); BSP_dispatch(G_SIG); BSP_dispatch(C_SIG); BSP_dispatch(C_SIG); } else { /* interactive version */ PRINTF_S("\n", ""); for (;;) { /* event loop */ int c; QSignal sig; c = (uint8_t)QF_consoleWaitForKey(); if ('a' <= c && c <= 'i') { /* in range? */ sig = (QSignal)(c - 'a' + A_SIG); } else if ('A' <= c && c <= 'I') { /* in range? */ sig = (QSignal)(c - 'A' + A_SIG); } else if (c == '\33') { /* the ESC key? */ sig = TERMINATE_SIG; } else { sig = IGNORE_SIG; } BSP_dispatch(sig); } } QF_onCleanup(); return 0; } ================================================ FILE: examples/workstation/qhsmtst/qhsmtst.c ================================================ /*.$file${.::qhsmtst.c} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: qhsmtst.qm * File: ${.::qhsmtst.c} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::qhsmtst.c} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include "qpn.h" #include "bsp.h" #include "qhsmtst.h" /*.$declare${HSMs::QHsmTst} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${HSMs::QHsmTst} ........................................................*/ typedef struct QHsmTst { /* protected: */ QHsm super; /* private: */ uint8_t foo; /* private state histories */ QStateHandler hist_s1; } QHsmTst; /* protected: */ static QState QHsmTst_initial(QHsmTst * const me); static QState QHsmTst_s(QHsmTst * const me); static QState QHsmTst_s1(QHsmTst * const me); static QState QHsmTst_s11(QHsmTst * const me); static QState QHsmTst_s2(QHsmTst * const me); static QState QHsmTst_s21(QHsmTst * const me); static QState QHsmTst_s211(QHsmTst * const me); /*.$enddecl${HSMs::QHsmTst} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ static QHsmTst l_hsmtst; /* the only instance of the QHsmTst class */ /* global-scope definitions ---------------------------------------*/ QHsm * const the_hsm = (QHsm *)&l_hsmtst; /* the opaque pointer */ /*.$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*. Check for the minimum required QP version */ #if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U)) #error qpn version 6.5.0 or higher required #endif /*.$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${HSMs::QHsmTst_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${HSMs::QHsmTst_ctor} ...................................................*/ void QHsmTst_ctor(void) { QHsmTst *me = &l_hsmtst; QHsm_ctor(&me->super, Q_STATE_CAST(&QHsmTst_initial)); } /*.$enddef${HSMs::QHsmTst_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ /*.$define${HSMs::QHsmTst} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${HSMs::QHsmTst} ........................................................*/ /*.${HSMs::QHsmTst::SM} ....................................................*/ static QState QHsmTst_initial(QHsmTst * const me) { /*.${HSMs::QHsmTst::SM::initial} */ me->foo = 0U; BSP_display("top-INIT;"); /* state history attributes */ /* state history attributes */ me->hist_s1 = Q_STATE_CAST(&QHsmTst_s11); return Q_TRAN(&QHsmTst_s2); } /*.${HSMs::QHsmTst::SM::s} .................................................*/ static QState QHsmTst_s(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s} */ case Q_ENTRY_SIG: { BSP_display("s-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s} */ case Q_EXIT_SIG: { BSP_display("s-EXIT;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::initial} */ case Q_INIT_SIG: { BSP_display("s-INIT;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /*.${HSMs::QHsmTst::SM::s::I} */ case I_SIG: { /*.${HSMs::QHsmTst::SM::s::I::[me->foo]} */ if (me->foo) { me->foo = 0U; BSP_display("s-I;"); status_ = Q_HANDLED(); } else { status_ = Q_UNHANDLED(); } break; } /*.${HSMs::QHsmTst::SM::s::E} */ case E_SIG: { BSP_display("s-E;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /*.${HSMs::QHsmTst::SM::s::TERMINATE} */ case TERMINATE_SIG: { BSP_exit(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; } /*.${HSMs::QHsmTst::SM::s::s1} .............................................*/ static QState QHsmTst_s1(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s::s1} */ case Q_ENTRY_SIG: { BSP_display("s1-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s1} */ case Q_EXIT_SIG: { BSP_display("s1-EXIT;"); /* save deep history */ me->hist_s1 = QHsm_state(me); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s1::initial} */ case Q_INIT_SIG: { BSP_display("s1-INIT;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /*.${HSMs::QHsmTst::SM::s::s1::I} */ case I_SIG: { BSP_display("s1-I;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s1::D} */ case D_SIG: { /*.${HSMs::QHsmTst::SM::s::s1::D::[!me->foo]} */ if (!me->foo) { me->foo = 1U; BSP_display("s1-D;"); status_ = Q_TRAN(&QHsmTst_s); } else { status_ = Q_UNHANDLED(); } break; } /*.${HSMs::QHsmTst::SM::s::s1::A} */ case A_SIG: { BSP_display("s1-A;"); status_ = Q_TRAN(&QHsmTst_s1); break; } /*.${HSMs::QHsmTst::SM::s::s1::B} */ case B_SIG: { BSP_display("s1-B;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /*.${HSMs::QHsmTst::SM::s::s1::F} */ case F_SIG: { BSP_display("s1-F;"); status_ = Q_TRAN(&QHsmTst_s211); break; } /*.${HSMs::QHsmTst::SM::s::s1::C} */ case C_SIG: { BSP_display("s1-C;"); status_ = Q_TRAN(&QHsmTst_s2); break; } default: { status_ = Q_SUPER(&QHsmTst_s); break; } } return status_; } /*.${HSMs::QHsmTst::SM::s::s1::s11} ........................................*/ static QState QHsmTst_s11(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s::s1::s11} */ case Q_ENTRY_SIG: { BSP_display("s11-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s1::s11} */ case Q_EXIT_SIG: { BSP_display("s11-EXIT;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s1::s11::H} */ case H_SIG: { BSP_display("s11-H;"); status_ = Q_TRAN(&QHsmTst_s); break; } /*.${HSMs::QHsmTst::SM::s::s1::s11::D} */ case D_SIG: { /*.${HSMs::QHsmTst::SM::s::s1::s11::D::[me->foo]} */ if (me->foo) { me->foo = 0U; BSP_display("s11-D;"); status_ = Q_TRAN(&QHsmTst_s1); } else { status_ = Q_UNHANDLED(); } break; } /*.${HSMs::QHsmTst::SM::s::s1::s11::G} */ case G_SIG: { BSP_display("s11-G;"); status_ = Q_TRAN(&QHsmTst_s211); break; } default: { status_ = Q_SUPER(&QHsmTst_s1); break; } } return status_; } /*.${HSMs::QHsmTst::SM::s::s2} .............................................*/ static QState QHsmTst_s2(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s::s2} */ case Q_ENTRY_SIG: { BSP_display("s2-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2} */ case Q_EXIT_SIG: { BSP_display("s2-EXIT;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2::initial} */ case Q_INIT_SIG: { BSP_display("s2-INIT;"); status_ = Q_TRAN(&QHsmTst_s211); break; } /*.${HSMs::QHsmTst::SM::s::s2::I} */ case I_SIG: { /*.${HSMs::QHsmTst::SM::s::s2::I::[!me->foo]} */ if (!me->foo) { me->foo = 1U; BSP_display("s2-I;"); status_ = Q_HANDLED(); } else { status_ = Q_UNHANDLED(); } break; } /*.${HSMs::QHsmTst::SM::s::s2::F} */ case F_SIG: { BSP_display("s2-F;"); status_ = Q_TRAN_HIST(me->hist_s1); break; } /*.${HSMs::QHsmTst::SM::s::s2::C} */ case C_SIG: { BSP_display("s2-C;"); status_ = Q_TRAN(&QHsmTst_s1); break; } default: { status_ = Q_SUPER(&QHsmTst_s); break; } } return status_; } /*.${HSMs::QHsmTst::SM::s::s2::s21} ........................................*/ static QState QHsmTst_s21(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s::s2::s21} */ case Q_ENTRY_SIG: { BSP_display("s21-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21} */ case Q_EXIT_SIG: { BSP_display("s21-EXIT;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::initial} */ case Q_INIT_SIG: { BSP_display("s21-INIT;"); status_ = Q_TRAN(&QHsmTst_s211); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::G} */ case G_SIG: { BSP_display("s21-G;"); status_ = Q_TRAN(&QHsmTst_s1); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::A} */ case A_SIG: { BSP_display("s21-A;"); status_ = Q_TRAN(&QHsmTst_s21); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::B} */ case B_SIG: { BSP_display("s21-B;"); status_ = Q_TRAN(&QHsmTst_s211); break; } default: { status_ = Q_SUPER(&QHsmTst_s2); break; } } return status_; } /*.${HSMs::QHsmTst::SM::s::s2::s21::s211} ..................................*/ static QState QHsmTst_s211(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /*.${HSMs::QHsmTst::SM::s::s2::s21::s211} */ case Q_ENTRY_SIG: { BSP_display("s211-ENTRY;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::s211} */ case Q_EXIT_SIG: { BSP_display("s211-EXIT;"); status_ = Q_HANDLED(); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::s211::H} */ case H_SIG: { BSP_display("s211-H;"); status_ = Q_TRAN(&QHsmTst_s); break; } /*.${HSMs::QHsmTst::SM::s::s2::s21::s211::D} */ case D_SIG: { BSP_display("s211-D;"); status_ = Q_TRAN(&QHsmTst_s21); break; } default: { status_ = Q_SUPER(&QHsmTst_s21); break; } } return status_; } /*.$enddef${HSMs::QHsmTst} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ ================================================ FILE: examples/workstation/qhsmtst/qhsmtst.h ================================================ /*.$file${.::qhsmtst.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /* * Model: qhsmtst.qm * File: ${.::qhsmtst.h} * * This code has been generated by QM 4.6.0 . * DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ /*.$endhead${.::qhsmtst.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #ifndef QHSMTST_H #define QHSMTST_H enum QHsmTstSignals { A_SIG = Q_USER_SIG, B_SIG, C_SIG, D_SIG, E_SIG, F_SIG, G_SIG, H_SIG, I_SIG, TERMINATE_SIG, IGNORE_SIG, MAX_SIG }; extern QHsm * const the_hsm; /* opaque pointer to the test HSM */ /*.$declare${HSMs::QHsmTst_ctor} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ /*.${HSMs::QHsmTst_ctor} ...................................................*/ void QHsmTst_ctor(void); /*.$enddecl${HSMs::QHsmTst_ctor} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #endif /* QHSMTST_H */ ================================================ FILE: examples/workstation/qhsmtst/qhsmtst.qm ================================================ QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting. Test active object me->foo = 0U; BSP_display("top-INIT;"); BSP_display("s-ENTRY;"); BSP_display("s-EXIT;"); BSP_display("s-INIT;"); me->foo me->foo = 0U; BSP_display("s-I;"); BSP_display("s-E;"); BSP_exit(); BSP_display("s1-ENTRY;"); BSP_display("s1-EXIT;"); BSP_display("s1-INIT;"); BSP_display("s1-I;"); !me->foo me->foo = 1U; BSP_display("s1-D;"); BSP_display("s1-A;"); BSP_display("s1-B;"); BSP_display("s1-F;"); BSP_display("s1-C;"); BSP_display("s11-ENTRY;"); BSP_display("s11-EXIT;"); BSP_display("s11-H;"); me->foo me->foo = 0U; BSP_display("s11-D;"); BSP_display("s11-G;"); BSP_display("s2-ENTRY;"); BSP_display("s2-EXIT;"); BSP_display("s2-INIT;"); !me->foo me->foo = 1U; BSP_display("s2-I;"); BSP_display("s2-F;"); BSP_display("s2-C;"); BSP_display("s21-ENTRY;"); BSP_display("s21-EXIT;"); BSP_display("s21-INIT;"); BSP_display("s21-G;"); BSP_display("s21-A;"); BSP_display("s21-B;"); BSP_display("s211-ENTRY;"); BSP_display("s211-EXIT;"); BSP_display("s211-H;"); BSP_display("s211-D;"); QHsmTst *me = &l_hsmtst; QHsm_ctor(&me->super, Q_STATE_CAST(&QHsmTst_initial)); #ifndef QHSMTST_H #define QHSMTST_H enum QHsmTstSignals { A_SIG = Q_USER_SIG, B_SIG, C_SIG, D_SIG, E_SIG, F_SIG, G_SIG, H_SIG, I_SIG, TERMINATE_SIG, IGNORE_SIG, MAX_SIG }; extern QHsm * const the_hsm; /* opaque pointer to the test HSM */ $declare(HSMs::QHsmTst_ctor) #endif /* QHSMTST_H */ #include "qpn.h" #include "bsp.h" #include "qhsmtst.h" $declare(HSMs::QHsmTst) static QHsmTst l_hsmtst; /* the only instance of the QHsmTst class */ /* global-scope definitions ---------------------------------------*/ QHsm * const the_hsm = (QHsm *)&l_hsmtst; /* the opaque pointer */ $define(HSMs::QHsmTst_ctor) $define(HSMs::QHsmTst) ================================================ FILE: examples/workstation/qhsmtst/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the QHsmTst example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 1U #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/reminder/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := reminder #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ reminder.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/reminder/bsp.c ================================================ /***************************************************************************** * Product: BSP for QP-nano example * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "reminder.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*..........................................................................*/ void BSP_init(void) { } /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const file, int_t line) { FPRINTF_S(stderr, "Assertion failed in %s, line %d", file, line); exit(-1); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!\n"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case '\33': { /* ESC pressed? */ QACTIVE_POST_ISR((QActive *)&AO_Sensor, TERMINATE_SIG, 0U); break; } } } ================================================ FILE: examples/workstation/reminder/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last updated for version 5.4.0 * Last updated on 2015-05-24 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); #endif /* BSP_H */ ================================================ FILE: examples/workstation/reminder/main.c ================================================ /***************************************************************************** * Product: "Reminder" design pattern example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "reminder.h" /* Application interface */ /* test harness ============================================================*/ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_sensorQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Sensor, l_sensorQueue, Q_DIM(l_sensorQueue) } }; /*..........................................................................*/ int main (void) { Sensor_ctor(); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/reminder/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the "Reminder" state pattern example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/reminder/reminder.c ================================================ /***************************************************************************** * Product: "Reminder" state pattern example (Section 5.2 in PSiCC2) * Last updated for version 5.4.2 * Last updated on 2015-06-07 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "reminder.h" #include "safe_std.h" /* portable "safe" / facilities */ /*..........................................................................*/ typedef struct SensorTag { QActive super; /* inherit QActive */ uint16_t pollCtr; uint16_t procCtr; } Sensor; /* hierarchical state machine ... */ static QState Sensor_initial (Sensor * const me); static QState Sensor_polling (Sensor * const me); static QState Sensor_processing(Sensor * const me); static QState Sensor_idle (Sensor * const me); static QState Sensor_busy (Sensor * const me); static QState Sensor_final (Sensor * const me); /* Global objects ----------------------------------------------------------*/ Sensor AO_Sensor; /*..........................................................................*/ void Sensor_ctor(void) { QActive_ctor((QActive *)&AO_Sensor, (QStateHandler)&Sensor_initial); } /* HSM definition ----------------------------------------------------------*/ QState Sensor_initial(Sensor * const me) { me->pollCtr = 0; me->procCtr = 0; return Q_TRAN(&Sensor_polling); } /*..........................................................................*/ QState Sensor_final(Sensor * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { QF_stop(); /* terminate the application */ status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Sensor_polling(Sensor * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { /* timeout in 1/2 second and every 1/2 second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); status = Q_HANDLED(); break; } case Q_EXIT_SIG: { QActive_disarmX(&me->super, 0U); status = Q_HANDLED(); break; } case Q_INIT_SIG: { status = Q_TRAN(&Sensor_processing); break; } case Q_TIMEOUT_SIG: { /* timeout in 1/2 second */ ++me->pollCtr; PRINTF_S("poll %3d\n", me->pollCtr); if ((me->pollCtr & 0x3U) == 0U) { /* modulo 4 */ QACTIVE_POST(&me->super, DATA_READY_SIG, 0U); } status = Q_HANDLED(); break; } case TERMINATE_SIG: { status = Q_TRAN(&Sensor_final); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Sensor_processing(Sensor * const me) { QState status; switch (Q_SIG(me)) { case Q_INIT_SIG: { status = Q_TRAN(&Sensor_idle); break; } default: { status = Q_SUPER(&Sensor_polling); break; } } return status; } /*..........................................................................*/ QState Sensor_idle(Sensor * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "-> idle"); status = Q_HANDLED(); break; } case DATA_READY_SIG: { status = Q_TRAN(&Sensor_busy); break; } default: { status = Q_SUPER(&Sensor_processing); break; } } return status; } /*..........................................................................*/ QState Sensor_busy(Sensor * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { PRINTF_S("%s\n", "-> busy"); status = Q_HANDLED(); break; } case Q_TIMEOUT_SIG: { /* timeout in 1/2 second and every 1/2 second */ QActive_armX(&me->super, 0U, BSP_TICKS_PER_SEC/2U, BSP_TICKS_PER_SEC/2U); ++me->procCtr; PRINTF_S("process %3d\n", me->procCtr); if ((me->procCtr & 0x1U) == 0U) { /* modulo 2 */ status = Q_TRAN(&Sensor_idle); } else { status = Q_HANDLED(); } break; } default: { status = Q_SUPER(&Sensor_processing); break; } } return status; } ================================================ FILE: examples/workstation/reminder/reminder.h ================================================ /***************************************************************************** * Product: Reminder state pattern example * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef REMINDER_H #define REMINDER_H enum SensorSignals { TERMINATE_SIG = Q_USER_SIG, /* terminate the application */ DATA_READY_SIG /* the invented reminder signal */ }; /* active objects ..........................................................*/ extern struct SensorTag AO_Sensor; /* the Sensor active object */ void Sensor_ctor(void); /* the Sensor constructor */ #endif /* REMINDER_H */ ================================================ FILE: examples/workstation/reminder2/Makefile ================================================ ############################################################################## # Product: Makefile for QP-nano for Windows and POSIX *HOSTS* # Last updated for version 6.4.0 # Last updated on 2019-01-09 # # Q u a n t u m L e a P s # ------------------------ # Modern Embedded Software # # Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. # # This program is open source software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Alternatively, this program may be distributed and modified under the # terms of Quantum Leaps commercial licenses, which expressly supersede # the GNU General Public License and are specifically designed for # licensees interested in retaining the proprietary status of their code. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # Contact information: # https://www.state-machine.com # mailto:info@state-machine.com ############################################################################## # # examples of invoking this Makefile: # building configurations: Debug (default), Release, and Spy # make # make CONF=rel # # cleaning configurations: Debug (default), Release, and Spy # make clean # make CONF=rel clean # # NOTE: # To use this Makefile on Windows, you will need the GNU make utility, which # is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # #----------------------------------------------------------------------------- # project name: # PROJECT := reminder2 #----------------------------------------------------------------------------- # project directories: # # list of all source directories used by this project VPATH := . \ # list of all include directories needed by this project INCLUDES := -I. \ # location of the QP-nano framework (if not provided in an env. variable) ifeq ($(QPN),) QPN := ../../.. endif #----------------------------------------------------------------------------- # project files: # # C source files... C_SRCS := \ bsp.c \ main.c \ reminder2.c # C++ source files... CPP_SRCS := LIB_DIRS := LIBS := # defines... DEFINES := ifeq (,$(CONF)) CONF := dbg endif #----------------------------------------------------------------------------- # add QP-nano framework (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) QPN_PORT_DIR := $(QPN)/ports/win32-qv C_SRCS += \ qepn.c \ qfn_win32.c else QPN_PORT_DIR := $(QPN)/ports/posix-qv C_SRCS += \ qepn.c \ qfn_posix.c LIBS += -lpthread endif #============================================================================ # Typically you should not need to change anything below this line VPATH += $(QPN)/src/qfn $(QPN_PORT_DIR) INCLUDES += -I$(QPN)/include -I$(QPN)/src -I$(QPN_PORT_DIR) #----------------------------------------------------------------------------- # GNU toolset: # # NOTE: # GNU toolset (MinGW) is included in the QTools collection for Windows, see: # http://sourceforge.net/projects/qpc/files/QTools/ # It is assumed that %QTOOLS%\bin directory is added to the PATH # CC := gcc CPP := g++ LINK := gcc # for C programs #LINK := g++ # for C++ programs #----------------------------------------------------------------------------- # basic utilities (depends on the OS this Makefile runs on): # ifeq ($(OS),Windows_NT) MKDIR := mkdir RM := rm TARGET_EXT := .exe else ifeq ($(OSTYPE),cygwin) MKDIR := mkdir -p RM := rm -f TARGET_EXT := .exe else MKDIR := mkdir -p RM := rm -f TARGET_EXT := endif #----------------------------------------------------------------------------- # build configurations... ifeq (rel, $(CONF)) # Release configuration .................................. BIN_DIR := build_rel # gcc options: CFLAGS = -c -O3 -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) -DNDEBUG CPPFLAGS = -c -O3 -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) -DNDEBUG else # default Debug configuration ......................................... BIN_DIR := build # gcc options: CFLAGS = -c -g -O -fno-pie -std=c99 -pedantic -Wall -Wextra -W \ $(INCLUDES) $(DEFINES) CPPFLAGS = -c -g -O -fno-pie -std=c++11 -pedantic -Wall -Wextra \ -fno-rtti -fno-exceptions \ $(INCLUDES) $(DEFINES) endif # ..................................................................... LINKFLAGS := #----------------------------------------------------------------------------- C_OBJS := $(patsubst %.c,%.o, $(C_SRCS)) CPP_OBJS := $(patsubst %.cpp,%.o, $(CPP_SRCS)) TARGET_EXE := $(BIN_DIR)/$(PROJECT)$(TARGET_EXT) C_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(C_OBJS)) C_DEPS_EXT := $(patsubst %.o,%.d, $(C_OBJS_EXT)) CPP_OBJS_EXT := $(addprefix $(BIN_DIR)/, $(CPP_OBJS)) CPP_DEPS_EXT := $(patsubst %.o,%.d, $(CPP_OBJS_EXT)) # create $(BIN_DIR) if it does not exist ifeq ("$(wildcard $(BIN_DIR))","") $(shell $(MKDIR) $(BIN_DIR)) endif #----------------------------------------------------------------------------- # rules # all: $(TARGET_EXE) $(TARGET_EXE) : $(C_OBJS_EXT) $(CPP_OBJS_EXT) $(LINK) $(LINKFLAGS) $(LIB_DIRS) -o $@ $^ $(LIBS) $(BIN_DIR)/%.d : %.c $(CC) -MM -MT $(@:.d=.o) $(CFLAGS) $< > $@ $(BIN_DIR)/%.d : %.cpp $(CPP) -MM -MT $(@:.d=.o) $(CPPFLAGS) $< > $@ $(BIN_DIR)/%.o : %.c $(CC) $(CFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.cpp $(CPP) $(CPPFLAGS) $< -o $@ $(BIN_DIR)/%.o : %.rc $(RC) $(RCINCLUDES) -i $< -o $@ # include dependency files only if our goal depends on their existence ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),show) -include $(C_DEPS_EXT) $(CPP_DEPS_EXT) endif endif .PHONY : clean show clean : -$(RM) $(BIN_DIR)/*.o \ $(BIN_DIR)/*.d \ $(TARGET_EXE) show : @echo PROJECT = $(PROJECT) @echo TARGET_EXE = $(TARGET_EXE) @echo VPATH = $(VPATH) @echo C_SRCS = $(C_SRCS) @echo CPP_SRCS = $(CPP_SRCS) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo C_OBJS_EXT = $(C_OBJS_EXT) @echo C_DEPS_EXT = $(C_DEPS_EXT) @echo CPP_DEPS_EXT = $(CPP_DEPS_EXT) @echo CPP_OBJS_EXT = $(CPP_OBJS_EXT) @echo LIB_DIRS = $(LIB_DIRS) @echo LIBS = $(LIBS) @echo DEFINES = $(DEFINES) ================================================ FILE: examples/workstation/reminder2/bsp.c ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last Updated for Version: 6.3.7 * Date of the Last Update: 2018-12-13 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2018 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "reminder2.h" #include "safe_std.h" /* portable "safe" / facilities */ #include //Q_DEFINE_THIS_FILE /*..........................................................................*/ void BSP_init(void) { PRINTF_S("Reminder state pattern example2\nQP-nano version: %s\n" "Press 'e' to echo the current state of number cruncher ON\n" "Press ESC to quit\n" "Number crunching started...\n", QP_getVersion()); } /*..........................................................................*/ void BSP_echo(double sum) { PRINTF_S("Echo! pi=%16.14f\n", 4.0*sum); fflush(stdout); } /*..........................................................................*/ void BSP_result(double sum) { PRINTF_S("pi=%16.14f\n", 4.0*sum); fflush(stdout); } /*--------------------------------------------------------------------------*/ void QF_onStartup(void) { QF_consoleSetup(); QF_setTickRate(BSP_TICKS_PER_SEC, 50); /* desired tick rate/ticker-prio */ } /*..........................................................................*/ void QF_onCleanup(void) { PRINTF_S("\n%s\n", "Bye! Bye!"); QF_consoleCleanup(); } /*..........................................................................*/ void QF_onClockTickISR(void) { QF_tickXISR(0U); /* perform the QF-nano clock tick processing */ switch (QF_consoleGetKey()) { case '\33': { /* ESC pressed? */ QACTIVE_POST_ISR((QActive *)&AO_Cruncher, TERMINATE_SIG, 0); break; } case 'e': { /* echo event */ QACTIVE_POST_ISR((QActive *)&AO_Cruncher, ECHO_SIG, 0); break; } } } /*..........................................................................*/ Q_NORETURN Q_onAssert(char_t const Q_ROM * const file, int_t line) { FPRINTF_S(stderr, "Assertion failed in %s, line %d", file, line); exit(-1); } ================================================ FILE: examples/workstation/reminder2/bsp.h ================================================ /***************************************************************************** * Product: BSP for QP-nano example, Win32 * Last updated for version 5.4.0 * Last updated on 2015-05-24 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef BSP_H #define BSP_H #define BSP_TICKS_PER_SEC 100U void BSP_init(void); void BSP_echo(double sum); void BSP_result(double sum); #endif /* BSP_H */ ================================================ FILE: examples/workstation/reminder2/main.c ================================================ /***************************************************************************** * Product: "Reminder" design pattern example * Last updated for version 5.8.0 * Last updated on 2016-11-06 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" /* QP-nano API */ #include "bsp.h" /* Board Support Package */ #include "reminder2.h" /* Application interface */ /* Local-scope objects -----------------------------------------------------*/ static QEvt l_cruncherQueue[2]; /* QF_active[] array defines all active object control blocks --------------*/ QActiveCB const Q_ROM QF_active[] = { { (QActive *)0, (QEvt *)0, 0U }, { (QActive *)&AO_Cruncher, l_cruncherQueue, Q_DIM(l_cruncherQueue) } }; /*..........................................................................*/ int main (void) { Cruncher_ctor(); QF_init(Q_DIM(QF_active)); /* initialize the QF-nano framework */ BSP_init(); /* initialize the Board Support Package */ return QF_run(); /* transfer control to QF-nano */ } ================================================ FILE: examples/workstation/reminder2/qpn_conf.h ================================================ /***************************************************************************** * Product: QP-nano configuration for the "Reminder" state pattern example * Last Updated for Version: 5.6.2 * Date of the Last Update: 2016-04-05 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef QPN_CONF_H #define QPN_CONF_H #define Q_PARAM_SIZE 4U #define QF_TIMEEVT_CTR_SIZE 2U #define QF_TIMEEVT_PERIODIC #endif /* QPN_CONF_H */ ================================================ FILE: examples/workstation/reminder2/reminder2.c ================================================ /***************************************************************************** * Product: "Reminder" state pattern example2 * Last updated for version 5.4.0 * Last updated on 2015-05-24 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #include "qpn.h" #include "bsp.h" #include "reminder2.h" /*..........................................................................*/ typedef struct CruncherTag { /* the Cruncher active object */ QActive super; /* inherit QActive */ double sum; /* internal variable */ } Cruncher; /* state machine ... */ static QState Cruncher_initial (Cruncher * const me); static QState Cruncher_processing(Cruncher * const me); static QState Cruncher_final (Cruncher * const me); /* Global objects ----------------------------------------------------------*/ Cruncher AO_Cruncher; /*--------------------------------------------------------------------------*/ void Cruncher_ctor(void) { QActive_ctor(&AO_Cruncher.super, Q_STATE_CAST(&Cruncher_initial)); } /*..........................................................................*/ QState Cruncher_initial(Cruncher * const me) { return Q_TRAN(&Cruncher_processing); } /*..........................................................................*/ QState Cruncher_processing(Cruncher * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { QACTIVE_POST(&me->super, CRUNCH_SIG, 0); me->sum = 0.0; status = Q_HANDLED(); break; } case CRUNCH_SIG: { uint32_t i = Q_PAR(me); uint32_t n = i; i += 100U; for (; n < i; ++n) { if ((n & 1) == 0) { me->sum += 1.0/(2*n + 1); } else { me->sum -= 1.0/(2*n + 1); } } if (i < 0x07000000U) { QACTIVE_POST(&me->super, CRUNCH_SIG, i); status = Q_HANDLED(); } else { BSP_result(me->sum); status = Q_TRAN(&Cruncher_processing); } break; } case ECHO_SIG: { BSP_echo(me->sum); status = Q_HANDLED(); break; } case TERMINATE_SIG: { status = Q_TRAN(&Cruncher_final); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } /*..........................................................................*/ QState Cruncher_final(Cruncher * const me) { QState status; switch (Q_SIG(me)) { case Q_ENTRY_SIG: { QF_stop(); /* terminate the application */ status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; } ================================================ FILE: examples/workstation/reminder2/reminder2.h ================================================ /***************************************************************************** * Product: Reminder state pattern example2 * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * *****************************************************************************/ #ifndef REMINDER2_H #define REMINDER2_H /*..........................................................................*/ enum ReminderSignals { CRUNCH_SIG = Q_USER_SIG, /* the invented reminder signal */ ECHO_SIG, /* check the responsiveness of the system */ TERMINATE_SIG /* terminate the application */ }; /* active objects ..........................................................*/ extern struct CruncherTag AO_Cruncher; /* the Cruncher active object */ void Cruncher_ctor(void); /* the Cruncher constructor */ #endif /* REMINDER2_H */ ================================================ FILE: include/qassert.h ================================================ /** * @file * @brief Customizable and memory-efficient assertions for embedded systems * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-01-21 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QASSERT_H #define QASSERT_H /** * @note * This header file can be used in C, C++, and mixed C/C++ programs. * * @note The preprocessor switch #Q_NASSERT disables checking assertions. * However, it is generally __not__ advisable to disable assertions, * __especially__ in the production code. Instead, the assertion handler * Q_onAssert() should be very carefully designed and tested. */ #ifdef Q_NASSERT /* Q_NASSERT defined--assertion checking disabled */ /* provide dummy (empty) definitions that don't generate any code... */ #define Q_DEFINE_THIS_FILE #define Q_DEFINE_THIS_MODULE(name_) #define Q_ASSERT(test_) ((void)0) #define Q_ASSERT_ID(id_, test_) ((void)0) #define Q_ALLEGE(test_) ((void)(test_)) #define Q_ALLEGE_ID(id_, test_) ((void)(test_)) #define Q_ERROR() ((void)0) #define Q_ERROR_ID(id_) ((void)0) #else /* Q_NASSERT not defined--assertion checking enabled */ #ifndef QP_VERSION /* is quassert.h used outside QP? */ /* provide typedefs so that qassert.h could be used "standalone"... */ /*! typedef for character strings. */ /** * @description * This typedef specifies character type for exclusive use in character * strings. Use of this type, rather than plain 'char', is in compliance * with the MISRA-C 2004 Rules 6.1(req), 6.3(adv). */ typedef char char_t; /*! typedef for assertions-ids and line numbers in assertions. */ /** * @description * This typedef specifies integer type for exclusive use in assertions. * Use of this type, rather than plain 'int', is in compliance * with the MISRA-C 2004 Rules 6.1(req), 6.3(adv). */ typedef int int_t; #ifndef Q_ROM /* if NOT defined, provide the default definition */ /*! macro for accessing data in ROM */ #define Q_ROM #endif #endif /*! Define the file name (with `__FILE__`) for assertions in this file. */ /** * @description * Macro to be placed at the top of each C/C++ module to define the * single instance of the file name string to be used in reporting * assertions in this module. * * @note The file name string literal is defined by means of the standard * preprocessor macro `__FILE__`. However, please note that, depending * on the compiler, the `__FILE__` macro might contain the whole path name * to the file, which might be inconvenient to log assertions. * @note This macro should __not__ be terminated by a semicolon. * @sa Q_DEFINE_THIS_MODULE() */ #define Q_DEFINE_THIS_FILE \ static char_t const Q_ROM Q_this_module_[] = __FILE__; /*! Define the user-specified module name for assertions in this file. */ /** * @description * Macro to be placed at the top of each C/C++ module to define the * single instance of the module name string to be used in reporting * assertions in this module. This macro takes the user-supplied parameter * @p name_ instead of `__FILE__` to precisely control the name of the * module. * * @param[in] name_ string constant representing the module name * * @note This macro should __not__ be terminated by a semicolon. */ #define Q_DEFINE_THIS_MODULE(name_) \ static char_t const Q_ROM Q_this_module_[] = name_; /*! General purpose assertion. */ /** * @description * Makes sure the @p test_ parameter is TRUE. Calls the Q_onAssert() * callback if the @p test_ expression evaluates to FALSE. This * macro identifies the assertion location within the file by means * of the standard `__LINE__` macro. * * @param[in] test_ Boolean expression * * @note the @p test_ is __not__ evaluated if assertions are disabled * with the #Q_NASSERT switch. */ #define Q_ASSERT(test_) ((test_) \ ? (void)0 : Q_onAssert(&Q_this_module_[0], (int_t)__LINE__)) /*! General purpose assertion with user-specified assertion-id. */ /** * @description * Makes sure the @p test_ parameter is TRUE. Calls the Q_onAssert() * callback if the @p test_ evaluates to FALSE. This assertion takes the * user-supplied parameter @p id_ to identify the location of this * assertion within the file. This avoids the volatility of using line * numbers, which change whenever a line of code is added or removed * upstream from the assertion. * * @param[in] id_ ID number (unique within the module) of the assertion * @param[in] test_ Boolean expression * * @note the @p test_ expression is __not__ evaluated if assertions are * disabled with the #Q_NASSERT switch. */ #define Q_ASSERT_ID(id_, test_) ((test_) \ ? (void)0 : Q_onAssert(&Q_this_module_[0], (int_t)(id_))) /*! General purpose assertion that __always__ evaluates the @p test_ * expression. */ /** * @description * Like the Q_ASSERT() macro, except it __always__ evaluates the @p test_ * expression even when assertions are disabled with the #Q_NASSERT macro. * However, when the #Q_NASSERT macro is defined, the Q_onAssert() * callback is __not__ called, even if @p test_ evaluates to FALSE. * * @param[in] test_ Boolean expression (__always__ evaluated) * * @sa #Q_ALLEGE_ID */ #define Q_ALLEGE(test_) Q_ASSERT(test_) /*! General purpose assertion with user-specified assertion-id that * __always__ evaluates the @p test_ expression. */ /** * @description * Like the Q_ASSERT_ID() macro, except it __always__ evaluates the * @p test_ expression even when assertions are disabled with the * #Q_NASSERT macro. However, when the #Q_NASSERT macro is defined, the * Q_onAssert() callback is __not__ called, even if @p test_ evaluates * to FALSE. * * @param[in] id_ ID number (unique within the module) of the assertion * @param[in] test_ Boolean expression */ #define Q_ALLEGE_ID(id_, test_) Q_ASSERT_ID((id_), (test_)) /*! Assertion for a wrong path through the code. */ /** * @description * Calls the Q_onAssert() callback if ever executed. * * @note Does noting if assertions are disabled with the #Q_NASSERT switch. */ #define Q_ERROR() \ Q_onAssert(&Q_this_module_[0], (int_t)__LINE__) /*! Assertion with user-specified assertion-id for a wrong path. */ /** * @description * Calls the Q_onAssert() callback if ever executed. This assertion * takes the user-supplied parameter @p id_ to identify the location of * this assertion within the file. This avoids the volatility of using * line numbers, which change whenever a line of code is added or removed * upstream from the assertion. * * @param[in] id_ ID number (unique within the module) of the assertion * * @note Does noting if assertions are disabled with the #Q_NASSERT switch. */ #define Q_ERROR_ID(id_) \ Q_onAssert(&Q_this_module_[0], (int_t)(id_)) #endif /* Q_NASSERT */ /****************************************************************************/ #ifdef __cplusplus extern "C" { #endif #ifndef Q_NORETURN /*! no-return function specifier */ #define Q_NORETURN void #endif /* Q_NORETURN */ /*! Callback function invoked in case of any assertion failure. */ /** * @description * This is an application-specific callback function needs to be defined in * the application to perform the clean system shutdown and perhaps a reset. * * @param[in] module name of the file/module in which the assertion failed * (constant, zero-terminated C string) * @param[in] location location of the assertion within the module. This could * be a line number or a user-specified ID-number. * * @note This callback function should _not_ return, as continuation after * an assertion failure does not make sense. * * @note The Q_onAssert() function is the last line of defense after the * system failure and its implementation shouild be very __carefully__ * designed and __tested__ under various fault conditions, including but * not limited to: stack overflow, stack corruption, or calling Q_onAssert() * from an interrupt. * * @note It is typically a __bad idea__ to implement Q_onAssert() as an * endless loop that ties up the CPU. During debuggin, Q_onAssert() is an * ideal place to put a breakpoint. * * Called by the following macros: #Q_ASSERT, #Q_REQUIRE, #Q_ENSURE, * #Q_ERROR, #Q_ALLEGE as well as #Q_ASSERT_ID, #Q_REQUIRE_ID, #Q_ENSURE_ID, * #Q_ERROR_ID, and #Q_ALLEGE_ID. */ Q_NORETURN Q_onAssert(char_t const Q_ROM * const module, int_t const location); #ifdef __cplusplus } #endif /*! Assertion for checking preconditions. */ /** * @description * This macro is equivalent to #Q_ASSERT, except the name provides a better * documentation of the intention of this assertion. * * @param[in] test_ Boolean expression */ #define Q_REQUIRE(test_) Q_ASSERT(test_) /*! Assertion for checking preconditions with user-specified assertion-id. */ /** * @description * Equivalent to #Q_ASSERT_ID, except the macro name provides a better * documentation of the intention of this assertion. * * @param[in] id_ ID number (unique within the module) of the assertion * @param[in] test_ Boolean expression */ #define Q_REQUIRE_ID(id_, test_) Q_ASSERT_ID((id_), (test_)) /*! Assertion for checking postconditions. */ /** Equivalent to #Q_ASSERT, except the macro name provides a better * documentation of the intention of this assertion. * * @param[in] test_ Boolean expression */ #define Q_ENSURE(test_) Q_ASSERT(test_) /*! Assertion for checking postconditions with user-specified assertion-id. */ /** * @description * Equivalent to #Q_ASSERT_ID, except the name provides a better documentation * of the intention of this assertion. * * @param[in] id_ ID number (unique within the module) of the assertion * @param[in] test_ Boolean expression */ #define Q_ENSURE_ID(id_, test_) Q_ASSERT_ID((id_), (test_)) /*! Assertion for checking invariants. */ /** * @description * Equivalent to #Q_ASSERT, except the macro name provides a better * documentation of the intention of this assertion. * * @param[in] test_ Boolean expression */ #define Q_INVARIANT(test_) Q_ASSERT(test_) /*! Assertion for checking invariants with user-specified assertion-id. */ /** * @description * Equivalent to #Q_ASSERT_ID, except the macro name provides a better * documentation of the intention of this assertion. * * @param[in] id_ ID number (unique within the module) of the assertion * @param[in] test_ Boolean expression */ #define Q_INVARIANT_ID(id_, test_) Q_ASSERT_ID((id_), (test_)) /*! Static (compile-time) assertion. */ /** * @description * This type of assertion deliberately causes a compile-time error when * the @p test_ evaluates to FALSE. The macro exploits the fact that in C/C++ * a dimension of an array cannot be negative. The compile-time assertion has * no runtime side effects. * * @param[in] test_ Compile-time Boolean expression */ #define Q_ASSERT_STATIC(test_) \ extern int_t Q_assert_static[(test_) ? 1 : -1] #define Q_ASSERT_COMPILE(test_) Q_ASSERT_STATIC(test_) /*! Helper macro to calculate static dimension of a 1-dim @p array_ */ #define Q_DIM(array_) (sizeof(array_) / sizeof((array_)[0])) #endif /* QASSERT_H */ ================================================ FILE: include/qepn.h ================================================ /** * @file * @brief Public QEP-nano interface. * @ingroup qepn * @cond ****************************************************************************** * Last updated for version 6.9.0 * Last updated on 2020-08-21 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QEPN_H #define QEPN_H /****************************************************************************/ /*! The current QP version as a decimal constant XXYZ, where XX is a 2-digit * major version number, Y is a 1-digit minor version number, and Z is * a 1-digit release number. */ #define QP_VERSION 690U /*! The current QP version number string of the form XX.Y.Z, where XX is * a 2-digit major version number, Y is a 1-digit minor version number, * and Z is a 1-digit release number. */ #define QP_VERSION_STR "6.9.0" /*! Encrypted current QP release (6.9.0) and date (2020-08-21) */ #define QP_RELEASE 0x884D22FDU /****************************************************************************/ /* typedefs for basic numerical types; MISRA-C 2004 rule 6.3(req). */ /*! typedef for character strings. */ /** * @description * This typedef specifies character type for exclusive use in character * strings. Use of this type, rather than plain 'char', is in compliance * with the MISRA-C 2004 Rules 6.1(req), 6.3(adv). */ typedef char char_t; /*! typedef for line numbers in assertions and return from QF_run() */ typedef int int_t; /*! typedef for enumerations used for event signals */ typedef int enum_t; /*! IEEE 754 32-bit floating point number, MISRA-C 2004 rule 6.3(req) */ /** * @note QP-nano does not use floating-point types anywhere in the internal * implementation. */ typedef float float32_t; /*! IEEE 754 64-bit floating point number, MISRA-C 2004 rule 6.3(req) */ /** * @note QP-nano does not use floating-point types anywhere in the internal * implementation. */ typedef double float64_t; /*! Scalar type describing the signal of an event. */ typedef uint8_t QSignal; #ifndef Q_PARAM_SIZE /*! The size of event parameter Valid values 0, 1, 2, 4 or 8; default 0 */ #define Q_PARAM_SIZE 0U #endif #if (Q_PARAM_SIZE == 0U) #elif (Q_PARAM_SIZE == 1U) typedef uint8_t QParam; #elif (Q_PARAM_SIZE == 2U) typedef uint16_t QParam; #elif (Q_PARAM_SIZE == 4U) /*! type of the event parameter. */ /** * @description * This typedef is configurable via the preprocessor switch #Q_PARAM_SIZE. * The other possible values of this type are as follows: @n * none when (Q_PARAM_SIZE == 0U);@n * uint8_t when (Q_PARAM_SIZE == 1U);@n * uint16_t when (Q_PARAM_SIZE == 2U);@n * uint32_t when (Q_PARAM_SIZE == 4U); and @n * uint64_t when (Q_PARAM_SIZE == 8U). */ typedef uint32_t QParam; #elif (Q_PARAM_SIZE == 8U) typedef uint64_t QParam; #else #error "Q_PARAM_SIZE defined incorrectly, expected 0U, 1U, 2U, 4U or 8U" #endif /****************************************************************************/ /*! Event structure. */ /** * @description * ::QEvt represents events, optionally with a single scalar parameter. * @sa Q_PARAM_SIZE * @sa ::QParam */ typedef struct { QSignal sig; /*!< signal of the event */ #if (Q_PARAM_SIZE != 0U) QParam par; /*!< scalar parameter of the event */ #endif } QEvt; /****************************************************************************/ /*! Macro to access the signal of the current event of a state machine */ /** * @param[in,out] me_ pointer to a subclass of ::QHsm (see @ref oop) */ #define Q_SIG(me_) (((QHsm *)(me_))->evt.sig) #if (Q_PARAM_SIZE != 0U) /*! Macro to access the parameter of the current event of a state machine */ /** * @param[in,out] me_ pointer to a subclass of ::QHsm (see @ref oop) */ #define Q_PAR(me_) (((QHsm *)(me_))->evt.par) #endif /* (Q_PARAM_SIZE != 0U) */ /****************************************************************************/ /*! Type returned from a state-handler function. */ typedef uint_fast8_t QState; /*! the signature of a state handler function */ typedef QState (*QStateHandler)(void * const me); /****************************************************************************/ /*! virtual table for the ::QHsm class. */ typedef struct QHsmVtable QHsmVtable; /*! Hierarchical State Machine */ /** * @description * QHsm represents a Hierarchical Finite State Machine (HSM) with full * support for hierarchical nesting of states, entry/exit actions, * and initial transitions in any composite state. * * @note QHsm is not intended to be instantiated directly, but rather serves * as the base structure for derivation of state machines in the application * code. * * @usage * The following example illustrates how to derive a state machine structure * from QHsm. Please note that the QHsm member 'super' is defined as the * _first_ member of the derived struct. * @include qepn_qhsm.c * * @sa @ref oop */ typedef struct { QHsmVtable const *vptr; /*!< virtual pointer */ QStateHandler state; /*!< current active state (state-variable) */ QStateHandler temp; /*!< temporary: tran. chain, target state, etc. */ QEvt evt; /*!< currently processed event in the HSM (protected) */ } QHsm; /*! Virtual table for the QHsm class */ struct QHsmVtable { /*! Triggers the top-most initial transition in a HSM. */ void (*init)(QHsm * const me); /*! Dispatches an event to a HSM. */ void (*dispatch)(QHsm * const me); }; /*! Polymorphically executes the top-most initial transition in a SM. */ /** * @param[in,out] me_ pointer (see @ref oop) * * @note Must be called only ONCE after the SM "constructor". * * @usage * The following example illustrates how to initialize a SM, and dispatch * events to it: * @include qepn_qhsm_use.c */ #define QHSM_INIT(me_) do { \ Q_ASSERT((me_)->vptr); \ (*(me_)->vptr->init)((me_)); \ } while (false) /*! Polymorphically dispatches an event to a HSM. */ /** * @description * Processes one event at a time in Run-to-Completion fashion. * * @param[in,out] me_ pointer (see @ref oop) * * @note Must be called after the "constructor" and after QHSM_INIT(). */ #define QHSM_DISPATCH(me_) ((*(me_)->vptr->dispatch)((me_))) /* public methods */ /*! "constructor" of a HSM. * @protected @memberof QHsm */ void QHsm_ctor(QHsm * const me, QStateHandler initial); /*! Obtain the current active state from a HSM (read only). */ /** * @param[in] me_ pointer (see @ref oop) * * @returns the current active state of a HSM */ #define QHsm_state(me_) (Q_STATE_CAST(Q_HSM_UPCAST(me_)->state)) /*! Obtain the current active child state of a given parent in QHsm * @public @memberof QHsm */ /** * @param[in] me_ pointer (see @ref oop) * @param[in] parent_ pointer to the parent state-handler * @returns the current active child state-handler of a given parent * @note this macro is used in QM for auto-generating code for state history */ #define QHsm_childState(me_, parent_) \ QHsm_childState_(Q_HSM_UPCAST(me_), Q_STATE_CAST(parent_)) /*! Helper function to obtain the current active child state of a parent */ QStateHandler QHsm_childState_(QHsm * const me, QStateHandler const parent); /*! Implementation of the top-most initial transition in QHsm. * @private @memberof QHsm */ void QHsm_init_(QHsm * const me); /*! Implementation of dispatching events to QHsm. * @private @memberof QHsm */ void QHsm_dispatch_(QHsm * const me); /*! the top-state. * @protected @memberof QHsm */ QState QHsm_top(void const * const me); /****************************************************************************/ /* All possible values returned from state/action handlers */ /* unhandled and need to "bubble up"... */ /*! event passed to superstate to handle */ #define Q_RET_SUPER ((QState)0) /*! event passed to submachine superstate */ #define Q_RET_SUPER_SUB ((QState)1) /*! event unhandled due to a guard */ #define Q_RET_UNHANDLED ((QState)2) /* handled and do not need to "bubble up"... */ /*! event handled (internal transition) */ #define Q_RET_HANDLED ((QState)3) /*! event silently ignored (bubbled up to top) */ #define Q_RET_IGNORED ((QState)4) /* entry/exit... */ /*! state entry action executed */ #define Q_RET_ENTRY ((QState)5) /*! state exit action executed */ #define Q_RET_EXIT ((QState)6) /* no side effects */ /*! return value without any effect */ #define Q_RET_NULL ((QState)7) /* transitions need to execute transition-action table in QHsm... */ /*! event handled (regular transition) */ #define Q_RET_TRAN ((QState)8) /*! initial transition in a state or submachine */ #define Q_RET_TRAN_INIT ((QState)9) /*! event handled (transition to history) */ #define Q_RET_TRAN_HIST ((QState)10) /*! Perform upcast from a subclass of ::QHsm to the base class ::QHsm */ /** * @description * Upcasting from a subclass to superclass is a very frequent and __safe__ * operation in object-oriented programming and object-oriented languages * (such as C++) perform such upcasting automatically. However, OOP is * implemented in C just as a set of coding conventions (see @ref oop), * and the C compiler does not "know" that certain types are related by * inheritance. Therefore for C, the upcast must be performed explicitly. * Unfortunately, pointer casting violates the advisory MISRA-C 2004 rule 11.4 * "cast pointer to pointer". This macro encapsulates this deviation and * provides a descriptive name for the reason of this cast. */ #define Q_HSM_UPCAST(ptr_) ((QHsm *)(ptr_)) /*! Perform cast to ::QStateHandler. */ /** * @description * This macro encapsulates the cast of a specific state handler function * pointer to QStateHandler, which violates MISRA-C 2004 rule 11.4(advisory). * This macro helps to localize this deviation. * * @usage * @include qepn_qhsm_ctor.c */ #define Q_STATE_CAST(handler_) ((QStateHandler)(handler_)) /*! Macro to call in a state-handler when it executes a regular * or and initial transition. Applicable to both HSMs and FSMs. * @include qepn_qtran.c */ #define Q_TRAN(target_) \ ((Q_HSM_UPCAST(me))->temp = Q_STATE_CAST(target_), (QState)Q_RET_TRAN) /*! Macro to call in a state-handler when it executes a transition * to history. Applicable only to HSMs. * * @usage * @include qepn_qhist.c */ #define Q_TRAN_HIST(hist_) \ ((Q_HSM_UPCAST(me))->temp = (hist_), (QState)Q_RET_TRAN_HIST) /*! Macro to call in a state-handler when it designates the * superstate of a given state. Applicable only to HSMs. * * @usage * @include qepn_qtran.c */ #define Q_SUPER(super_) \ ((Q_HSM_UPCAST(me))->temp = Q_STATE_CAST(super_), Q_RET_SUPER) /*! Macro to call in a state-handler when it handles an event. * Applicable to both HSMs and FSMs. */ #define Q_HANDLED() Q_RET_HANDLED /*! Macro to call in a state-handler when it attempts to handle * an event but a guard condition evaluates to 'false' and there is no other * explicit way of handling the event. Applicable only to HSMs. */ #define Q_UNHANDLED() Q_RET_UNHANDLED /*! QP reserved signals */ /*! signal for coding entry actions */ #define Q_ENTRY_SIG ((QSignal)1) /*! signal for coding exit actions */ #define Q_EXIT_SIG ((QSignal)2) /*! signal for coding nested initial transitions */ #define Q_INIT_SIG ((QSignal)3) /*! timeout signal at the default tick rate 0 */ #define Q_TIMEOUT_SIG ((QSignal)4) /*! timeout signal at tick rate 1 */ #define Q_TIMEOUT1_SIG ((QSignal)5) /*! timeout signal at tick rate 2 */ #define Q_TIMEOUT2_SIG ((QSignal)6) /*! timeout signal at tick rate 3 */ #define Q_TIMEOUT3_SIG ((QSignal)7) /*!< first signal for the user applications */ #define Q_USER_SIG ((QSignal)8) /*! Perform cast from unsigned integer to a pointer of type @a type_ */ /** * @description * This macro encapsulates the cast to (type_ *), which QP ports or * application might use to access embedded hardware registers. * Such uses can trigger PC-Lint "Note 923: cast from int to pointer" and * this macro helps to encapsulate this deviation. */ #define Q_UINT2PTR_CAST(type_, uintptr_) ((type_ *)(uintptr_)) /****************************************************************************/ /* macros for accessing data in ROM */ #ifndef Q_ROM /* if NOT defined, provide the default definition */ /*! Macro to specify compiler-specific directive for placing a * constant object in ROM. */ /** * @description * Many compilers for 8-bit Harvard-architecture MCUs provide non-standard * extensions to support placement of objects in different memories. * In order to conserve the precious RAM, QP-nano uses the Q_ROM macro for * all constant objects that can be allocated in ROM. * * @note * To override the following empty definition, you need to define the * Q_ROM macro in the qpn_port.h header file. Some examples of valid * Q_ROM macro definitions are: __code (IAR 8051 compiler), code (Keil * 8051 compiler), PROGMEM (gcc for AVR), __flash (IAR for AVR). */ #define Q_ROM #endif #ifndef Q_ROM_BYTE /*! Macro to access a byte allocated in ROM */ /** * Some compilers for Harvard-architecture MCUs, such as gcc for AVR, do * not generate correct code for accessing data allocated in the program * space (ROM). The workaround for such compilers is to explicitly add * assembly code to access each data element allocated in the program * space. The macro Q_ROM_BYTE() retrieves a byte from the given ROM * address. * * @note * The Q_ROM_BYTE() macro should be defined in the qpn_port.h header file * for each compiler that cannot handle correctly data allocated in ROM * (such as the gcc). If the macro is left undefined, the default * definition simply returns the parameter and lets the compiler * synthesize the correct code. */ #define Q_ROM_BYTE(rom_var_) (rom_var_) #endif #ifndef Q_ROM_PTR /*! Macro to access a pointer allocated in ROM */ /** * Some compilers for Harvard-architecture MCUs, such as gcc for AVR, do * not generate correct code for accessing data allocated in the program * space (ROM). The workaround for such compilers is to explicitly add * assembly code to access each data element allocated in the program * space. The macro Q_ROM_PTR() retrieves an object-pointer from the given * ROM address. Please note that the pointer can be pointing to the object * in RAM or ROM. * * @note * The Q_ROM_PTR() macro should be defined in the qpn_port.h header file * for each compiler that cannot handle correctly data allocated in ROM * (such as the gcc). If the macro is left undefined, the default * definition simply returns the parameter and lets the compiler * synthesize the correct code. */ #define Q_ROM_PTR(rom_var_) (rom_var_) #endif /****************************************************************************/ /*! the current QP version number string in ROM, based on QP_VERSION_STR */ extern char_t const Q_ROM QP_versionStr[7]; /*! get the current QP-nano version number string of the form "X.Y.Z" */ #define QP_getVersion() (QP_versionStr) #endif /* QEPN_H */ ================================================ FILE: include/qfn.h ================================================ /** * @file * @brief Public QF-nano interface. * @ingroup qfn * @cond ****************************************************************************** * Last updated for version 6.8.2 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_H #define QFN_H /** * @description * This header file must be included in all modules that use QP-nano. * Typically, this header file is included indirectly through the * header file qpn_port.h. */ /****************************************************************************/ #ifndef QF_TIMEEVT_CTR_SIZE /*! macro to override the default QTimeEvtCtr size. * Valid values 0U, 1U, 2U, or 4U; default 0U */ #define QF_TIMEEVT_CTR_SIZE 0U #endif #if (QF_TIMEEVT_CTR_SIZE == 0U) /* no time events */ #elif (QF_TIMEEVT_CTR_SIZE == 1U) typedef uint8_t QTimeEvtCtr; #elif (QF_TIMEEVT_CTR_SIZE == 2U) /*! type of the Time Event counter, which determines the dynamic * range of the time delays measured in clock ticks. */ /** * @description * This typedef is configurable via the preprocessor switch * #QF_TIMEEVT_CTR_SIZE. The other possible values of this type are * as follows: @n * none when (QF_TIMEEVT_CTR_SIZE not defined or == 0U), @n * uint8_t when (QF_TIMEEVT_CTR_SIZE == 1U); @n * uint16_t when (QF_TIMEEVT_CTR_SIZE == 2U); and @n * uint32_t when (QF_TIMEEVT_CTR_SIZE == 4U). */ typedef uint16_t QTimeEvtCtr; #elif (QF_TIMEEVT_CTR_SIZE == 4U) typedef uint32_t QTimeEvtCtr; #else #error "QF_TIMER_SIZE defined incorrectly, expected 1U, 2U, or 4U" #endif #if (QF_TIMEEVT_CTR_SIZE != 0U) /*! Timer structure the active objects */ typedef struct { QTimeEvtCtr nTicks; /*!< timer tick counter */ #ifdef QF_TIMEEVT_PERIODIC QTimeEvtCtr interval; /*!< timer interval */ #endif /* QF_TIMEEVT_PERIODIC */ } QTimer; #endif /* (QF_TIMEEVT_CTR_SIZE != 0U) */ #ifndef QF_MAX_TICK_RATE /*! Default value of the macro configurable value in qpn_port.h */ #define QF_MAX_TICK_RATE 1U #elif (QF_MAX_TICK_RATE > 4U) #error "QF_MAX_TICK_RATE exceeds the 4U limit" #endif /****************************************************************************/ /*! QActive active object (based on QHsm-implementation) * @extends QHsm */ /** * @description * QActive is the base structure for derivation of active objects. Active * objects in QF-nano are encapsulated tasks (each embedding a state machine * and an event queue) that communicate with one another asynchronously by * sending and receiving events. Within an active object, events are * processed sequentially in a run-to-completion (RTC) fashion, while QF * encapsulates all the details of thread-safe event exchange and queuing. * * @note ::QActive is not intended to be instantiated directly, but rather * serves as the base structure for derivation of active objects in the * application code. * * @usage * The following example illustrates how to derive an active object from * ::QActive. Please note that the ::QActive member super_ is defined as * the __first__ member of the derived struct. * @include qfn_qactive.c */ typedef struct QActive { QHsm super; /**< derives from the ::QHsm base class */ #if (QF_TIMEEVT_CTR_SIZE != 0U) /*! Timer for the active object */ QTimer tickCtr[QF_MAX_TICK_RATE]; #endif /* (QF_TIMEEVT_CTR_SIZE != 0U) */ /*! priority of the active object (1..8) */ uint8_t prio; /*! offset to where next event will be inserted into the buffer */ uint8_t volatile head; /*! offset of where next event will be extracted from the buffer */ uint8_t volatile tail; /*! number of events currently present in the queue * (events in the ring buffer + 1 event in the state machine) */ uint8_t volatile nUsed; } QActive; /*! Virtual table for the QActive class * @extends QHsmVtable */ typedef struct { QHsmVtable super; /*!< inherits QHsmVtable */ #if (Q_PARAM_SIZE != 0U) /*! virtual function to asynchronously post (FIFO) an event to an AO * (task context). */ /** @sa QACTIVE_POST() and QACTIVE_POST_X() */ bool (*post)(QActive * const me, uint_fast8_t const margin, enum_t const sig, QParam const par); /*! virtual function to asynchronously post (FIFO) an event to an AO * (ISR context). */ /** @sa QACTIVE_POST_ISR() and QACTIVE_POST_X_ISR() */ bool (*postISR)(QActive * const me, uint_fast8_t const margin, enum_t const sig, QParam const par); #else bool (*post) (QActive * const me, uint_fast8_t const margin, enum_t const sig); bool (*postISR)(QActive * const me, uint_fast8_t const margin, enum_t const sig); #endif } QActiveVtable; /*! protected "constructor" of an QActive active object. */ void QActive_ctor(QActive * const me, QStateHandler initial); /*! special value of margin that causes asserting failure in case * event posting fails. */ #define QF_NO_MARGIN ((uint_fast8_t)0xFF) #if (Q_PARAM_SIZE != 0U) /*! Polymorphically posts an event to an active object (FIFO) * with delivery guarantee (task context). */ /** * @description * This macro asserts if the queue overflows and cannot accept the event. * * @param[in,out] me_ pointer (see @ref oop) * @param[in] sig_ signal of the event to post * @param[in] par_ parameter of the event to post. * * @sa QACTIVE_POST_X(), QActive_postX_(), * QACTIVE_POST_ISR(), QActive_postXISR_(). * * @usage * @include qfn_post.c */ #define QACTIVE_POST(me_, sig_, par_) do { \ QActive * const ao_ = QF_ACTIVE_CAST((me_)); \ ((void)(*((QActiveVtable const *)(ao_->super.vptr))->post)( \ ao_, QF_NO_MARGIN, (enum_t)(sig_), (QParam)(par_)));\ } while (false) /*! Polymorphically posts an event to an active object (FIFO) * without delivery guarantee (task context). */ /** * @description * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * * @param[in,out] me_ pointer (see @ref oop) * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. * The special value #QF_NO_MARGIN causes asserting failure * in case event allocation fails. * @param[in] sig_ signal of the event to post * @param[in] par_ parameter of the event to post. * * @returns * 'true' if the posting succeeded, and 'false' if the posting failed * due to insufficient margin of free slots available in the queue. * * @usage * @include qfn_postx.c */ #define QACTIVE_POST_X(me_, margin_, sig_, par_) \ ((*((QActiveVtable const *)((me_)->super.vptr))->post)( \ (me_), (margin_), (enum_t)(sig_), (QParam)(par_))) /*! Polymorphically posts an event to an active object (FIFO) * with delivery guarantee (ISR context). */ /** * @description * This macro asserts if the queue overflows and cannot accept the event. * * @param[in,out] me_ pointer (see @ref oop) * @param[in] sig_ signal of the event to post * @param[in] par_ parameter of the event to post. * * @sa QACTIVE_POST_X(), QActive_postX_(). * * @usage * @include qfn_post.c */ #define QACTIVE_POST_ISR(me_, sig_, par_) do { \ QActive * const ao_ = QF_ACTIVE_CAST((me_)); \ ((void)(*((QActiveVtable const *)(ao_->super.vptr))->postISR)( \ ao_, QF_NO_MARGIN, (enum_t)(sig_), (QParam)(par_))); \ } while (false) /*! Polymorphically posts an event to an active object (FIFO) * without delivery guarantee (ISR context). */ /** * @description * This macro does not assert if the queue overflows and cannot accept * the event with the specified margin of free slots remaining. * * @param[in,out] me_ pointer (see @ref oop) * @param[in] margin_ the minimum free slots in the queue, which * must still be available after posting the event. * The special value #QF_NO_MARGIN causes asserting failure * in case event allocation fails. * @param[in] sig_ signal of the event to post * @param[in] par_ parameter of the event to post. * * @returns * 'true' if the posting succeeded, and 'false' if the posting failed * due to insufficient margin of free slots available in the queue. * * @usage * @include qfn_postx.c */ #define QACTIVE_POST_X_ISR(me_, margin_, sig_, par_) \ ((*((QActiveVtable const *)( \ QF_ACTIVE_CAST((me_))->super.vptr))->postISR)( \ QF_ACTIVE_CAST((me_)), (margin_), \ (enum_t)(sig_), (QParam)(par_))) /*! Implementation of the task-level event posting * @private @memberof QActive */ bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par); /*! Implementation of the ISR-level event posting * @private @memberof QActive */ bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par); #else /* no event parameter */ #define QACTIVE_POST(me_, sig_) do { \ QActive * const ao_ = QF_ACTIVE_CAST((me_)); \ ((void)(*((QActiveVtable const *)(ao_->super.vptr))->post)( \ ao_, QF_NO_MARGIN, (enum_t)(sig_))); \ } while (false) #define QACTIVE_POST_X(me_, margin_, sig_) \ ((*((QActiveVtable const *)((me_)->super.vptr))->post)((me_), \ (margin_), (sig_))) bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig); #define QACTIVE_POST_ISR(me_, sig_) do { \ QActive * const ao_ = QF_ACTIVE_CAST((me_)); \ ((void)(*((QActiveVtable const *)(ao_->super.vptr))->postISR)( \ ao_, QF_NO_MARGIN, (enum_t)(sig_))); \ } while (false) #define QACTIVE_POST_X_ISR(me_, margin_, sig_) \ ((*((QActiveVtable const *)( \ QF_ACTIVE_CAST((me_))->super.vptr))->postISR)( \ QF_ACTIVE_CAST((me_)), (margin_), (enum_t)(sig_))) bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig); #endif #if (QF_TIMEEVT_CTR_SIZE != 0U) /*! Processes all armed time events at every clock tick. */ void QF_tickXISR(uint_fast8_t const tickRate); #ifdef QF_TIMEEVT_PERIODIC /*! Arm the QP-nano one-shot time event. * @public @memberof QActive */ void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval); #else /*! Arm the QP-nano one-shot time event. * @public @memberof QActive */ void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks); #endif /*! Disarm a time event. Since the tick counter * @public @memberof QActive */ void QActive_disarmX(QActive * const me, uint_fast8_t const tickRate); #endif /* (QF_TIMEEVT_CTR_SIZE != 0U) */ /****************************************************************************/ /* QF-nano protected methods ...*/ /*! QF-nano initialization. */ void QF_init(uint_fast8_t maxActive); /*! QF-nano termination. */ /** * @description * This function terminates QF and performs any necessary cleanup. * In QF-nano this function is defined in the BSP. Many QF ports might not * require implementing QF_stop() at all, because many embedded applications * don't have anything to exit to. */ void QF_stop(void); /*! Startup QF-nano callback. */ /** * @description * The time line for calling QF_onStartup() depends on the particular * QF port. In most cases, QF_onStartup() is called from QF_run(), right * before starting any multitasking kernel or the background loop. * * @sa QF initialization example for ::QActiveCB. */ void QF_onStartup(void); /*! Transfers control to QF-nano to run the application. */ int_t QF_run(void); /****************************************************************************/ /*! QActive Control Block * * QActiveCB represents the read-only information that the QF-nano needs to * manage the active object. QActiveCB objects are grouped in the array * QF_active[], which typically can be placed in ROM. * * @usage * The following example illustrates how to allocate and initialize the * ::QActive control blocks in the array QF_active[]. * @include qfn_main.c */ typedef struct { QActive *act; /*!< pointer to the active object structure */ QEvt *queue; /*!< pointer to the event queue buffer */ uint8_t qlen; /*!< the length of the queue ring buffer */ } QActiveCB; /** active object control blocks */ /*lint -save -e9067 MISRA-C:2012 Rule 8.11, extern array declared without size */ extern QActiveCB const Q_ROM QF_active[]; /*lint -restore */ /*! number of active objects in the application (# elements in QF_active[]) */ extern uint_fast8_t QF_maxActive_; /*! Ready set of QF-nano. */ extern uint_fast8_t volatile QF_readySet_; #ifndef QF_LOG2 /*! Lookup table for (log2(n) + 1), where n is the index into the table. * This lookup delivers the 1-based number of the most significant 1-bit * of a nibble. */ extern uint8_t const Q_ROM QF_log2Lkup[16]; #endif #ifdef QF_TIMEEVT_USAGE /*! Timer set of QF-nano. */ extern uint_fast8_t volatile QF_timerSetX_[QF_MAX_TICK_RATE]; #endif /* QF_TIMEEVT_USAGE */ /*! Lookup table for ~(1 << (n - 1)), where n is the index into the table. */ extern uint8_t const Q_ROM QF_invPow2Lkup[9]; /****************************************************************************/ /*! This macro encapsulates accessing the active object queue at a * given index, which violates MISRA-C 2004 rules 17.4(req) and 11.4(adv). * This macro helps to localize this deviation. */ #define QF_ROM_QUEUE_AT_(ao_, i_) (((QEvt *)Q_ROM_PTR((ao_)->queue))[(i_)]) /*! This macro encapsulates accessing the active object control block, * which violates MISRA-C 2004 rule 11.4(adv). This macro helps to localize * this deviation. */ #define QF_ROM_ACTIVE_GET_(p_) ((QActive *)Q_ROM_PTR(QF_active[(p_)].act)) /*! This macro encapsulates the upcast to QActive* * * This macro encapsulates up-casting a pointer to a subclass of ::QActive * to the base class ::QActive, which violates MISRA-C 2004 rule 11.4(adv). * This macro helps to localize this deviation. */ #define QF_ACTIVE_CAST(a_) ((QActive *)(a_)) #endif /* QFN_H */ ================================================ FILE: include/qkn.h ================================================ /** * @file * @brief Public QK-nano interface. * @ingroup qkn * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QKN_H #define QKN_H /****************************************************************************/ /*! attributes of the QK kernel */ typedef struct { uint8_t volatile actPrio; /*!< prio of the active AO */ uint8_t volatile nextPrio; /*!< prio of the next AO to execute */ uint8_t volatile lockPrio; /*!< lock prio (0 == no-lock) */ uint8_t volatile lockHolder; /*!< prio of the lock holder */ uint8_t volatile intNest; /*!< ISR nesting level */ } QK_PrivAttr; /*! global attributes of the QK kernel */ extern QK_PrivAttr QK_attr_; /****************************************************************************/ /*! QK-nano scheduler finds the highest-priority thread ready to run */ uint_fast8_t QK_sched_(void); /*! QK activator activates the next active object. The activated AO preempts * the currently executing AOs. */ void QK_activate_(void); #ifndef QF_ISR_NEST #define QK_SCHEDULE_() do { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } while(false) #else /*! The macro to invoke the QK scheduler in the QK_ISR_EXIT() */ #define QK_SCHEDULE_() \ if (QK_attr_.intNest == 0U) { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } else ((void)0) #endif #ifdef QK_ON_CONTEXT_SW /*! QK-nano context switch callback (customized in BSPs for QK-nano) */ /** * @description * This callback function provides a mechanism to perform additional * custom operations when QK switches context from one thread to * another. * * @param[in] prev priority of the previous thread (active object) * (prev==0 means that @p prev was the QK idle loop) * @param[in] next priority of the next thread (active object) * (next==0) means that @p next is the QK idle loop) * @attention * QK_onContextSw() is invoked with interrupts **disabled** and must also * return with interrupts **disabled**. * * @note * This callback is enabled by defining the macro #QK_ON_CONTEXT_SW. * * @include qkn_oncontextsw.c */ void QK_onContextSw(uint_fast8_t prev, uint_fast8_t next); #endif /* QK_ON_CONTEXT_SW */ /*! QK idle callback (customized in BSPs for QK) * * QK_onIdle() is called continuously by the QK-nano idle loop. This callback * gives the application an opportunity to enter a power-saving CPU mode, * or perform some other idle processing. * * @note QK_onIdle() is invoked with interrupts enabled and must also * return with interrupts enabled. This is in contrast to the callback * QF_onIdle(), which is used by the non-preemptive QF-nano scheduler. */ void QK_onIdle(void); #ifdef QK_SCHED_LOCK /*! QK-nano Scheduler locking */ /*! The scheduler lock status */ typedef uint_fast16_t QSchedStatus; /*! QK Scheduler lock */ QSchedStatus QK_schedLock(uint_fast8_t ceiling); /*! QK Scheduler unlock */ void QK_schedUnlock(QSchedStatus stat); #endif /* QK_SCHED_LOCK */ #endif /* QKN_H */ ================================================ FILE: include/qpn.h ================================================ /** * @file * @brief QP-nano public interface including backwards-compatibility layer * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QPN_H #define QPN_H /** * @description * This header file must be included directly or indirectly * in all application modules (*.c files) that use QP-nano. */ #ifdef __cplusplus extern "C" { #endif #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #include "qassert.h" /* embedded systems-friendly assertions */ /****************************************************************************/ /* QP API compatibility layer */ #ifndef QP_API_VERSION /*! Macro that specifies the backwards compatibility with the * QP-nano API version. */ /** * @description * For example, QP_API_VERSION=450 will cause generating the compatibility * layer with QP-nano version 4.5.0 and newer, but not older than 4.5.0. * QP_API_VERSION=0 causes generation of the compatibility layer "from the * begining of time", which is the maximum backwards compatibilty. This is * the default.@n * @n * Conversely, QP_API_VERSION=9999 means that no compatibility layer should * be generated. This setting is useful for checking if an application * complies with the latest QP-nano API. */ #define QP_API_VERSION 0 #endif /* QP_API_VERSION */ /****************************************************************************/ #if (QP_API_VERSION < 580U) /*! @deprecated QMActive Control Block; instead use: ::QActiveCB. */ typedef QActiveCB QMActiveCB; /*! @deprecated QMActive; instead use: ::QActive. */ typedef QActive QMActive; /*! @deprecated QMsm state machine; instead use: ::QHsm. */ typedef QHsm QMsm; /*! @deprecated QMActive constructor; instead use: QActive_ctor() */ #define QMActive_ctor QActive_ctor /*! @deprecated QMsm state machine constructor; instead use: QHsm_ctor() */ #define QMsm_ctor QHsm_ctor #endif /* QP_API_VERSION < 580U */ /****************************************************************************/ #ifdef __cplusplus } #endif #endif /* QPN_H */ ================================================ FILE: include/qstamp.c ================================================ /** * @file * @brief Application build time-stamp * @note * This module needs to be re-compiled in every new software build. To achive * this, it is recommended to delete the object file (qstamp.o, or qstamp.obj) * in the build directory before each build. (Most development tools allow * you to specify a pre-build command, which is the ideal place to delete * the qstamp object file.) */ extern char const Q_BUILD_DATE[12]; extern char const Q_BUILD_TIME[9]; /*! the calendar date of the last translation of the form: "Mmm dd yyyy" */ char const Q_BUILD_DATE[12] = __DATE__; /*! the time of the last translation of the form: "hh:mm:ss" */ char const Q_BUILD_TIME[9] = __TIME__; ================================================ FILE: include/qvn.h ================================================ /** * @file * @brief Public QV-nano interface. * @ingroup qvn * @cond ****************************************************************************** * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QVN_H #define QVN_H /****************************************************************************/ /*! Ready set of QV-nano. */ extern uint_fast8_t volatile QV_readySet_; /*! QV idle callback (customized in BSPs for QK) * * QV_onIdle() is called continuously by the QV-nano scheduler. This callback * gives the application an opportunity to enter a power-saving CPU mode, * or perform some other idle processing. * * @note QV_onIdle() is invoked with interrupts disabled, but must return * with interrupts enabled. This is in contrast to the callback QK_onIdle(), * which is used by the preemptive QK-nano scheduler. */ void QV_onIdle(void); #endif /* QVN_H */ ================================================ FILE: ports/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/ports.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/arm-cm/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm-cm.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/arm-cm/qk/arm/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, preemptive QK-nano kernel, ARM-KEIL * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (not supported in ARM-Keil compiler 5) */ #define Q_NORETURN __declspec(noreturn) void /* QF interrupt disable/enable and log2()... */ #if (__TARGET_ARCH_THUMB == 3) /* Cortex-M0/M0+/M1(v6-M, v6S-M)? */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __disable_irq() #define QF_INT_ENABLE() __enable_irq() /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __disable_irq() #define QF_PRIMASK_ENABLE() __enable_irq() /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_set_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_set_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __clz(n_))) /* inline function for setting the BASEPRI register */ static __inline void QF_set_BASEPRI(unsigned basePri) { register unsigned volatile __regBasePri __asm("basepri"); __regBasePri = basePri; } #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST /* QK-nano initialization and ISR entry/exit */ #define QK_INIT() QK_init() void QK_init(void); #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ QF_INT_DISABLE(); \ if (QK_sched_() !=0U) { \ (*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (uint32_t)(1U << 28)); \ } \ QF_INT_ENABLE(); \ } while (false) #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qk/arm/qkn_port.c ================================================ /** * @file * @brief QK-nano port to ARM Cortex-M, ARM-KEIL toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ /* prototypes --------------------------------------------------------------*/ void PendSV_Handler(void); void NMI_Handler(void); void Thread_ret(void); #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) #define NVIC_ICSR 0xE000ED04 /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QK_init() can be later * changed by the application-level code. */ void QK_init(void) { #if (__TARGET_ARCH_THUMB != 3) /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M) */ uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M) */ /* SCB_SYSPRI3: PendSV set to the lowest priority 0xFF */ SCB_SYSPRI[3] |= (0xFFU << 16); } /***************************************************************************** * The PendSV_Handler exception handler is used for handling context switch * and asynchronous preemption in QK. The use of the PendSV exception is * the recommended and most efficient method for performing context switches * with ARM Cortex-M. * * The PendSV exception should have the lowest priority in the whole system * (0xFF, see QK_init). All other exceptions and interrupts should have higher * priority. For example, for NVIC with 2 priority bits all interrupts and * exceptions must have numerical value of priority lower than 0xC0. In this * case the interrupt priority levels available to your applications are (in * the order from the lowest urgency to the highest urgency): 0x80, 0x40, 0x00. * * Also, *all* "kernel aware" ISRs in the QK application must call the * QK_ISR_EXIT() macro, which triggers PendSV when it detects a need for * a context switch or asynchronous preemption. * * Due to tail-chaining and its lowest priority, the PendSV exception will be * entered immediately after the exit from the *last* nested interrupt (or * exception). In QK, this is exactly the time when the QK activator needs to * handle the asynchronous preemption. *****************************************************************************/ __asm void PendSV_Handler(void) { IMPORT QK_activate_ /* extern function */ PRESERVE8 /* preserve the 8-byte stack alignment */ /* Prepare some constants in registers before entering critical section */ LDR r3,=NVIC_ICSR /* Interrupt Control and State Register */ MOVS r1,#1 LSLS r1,r1,#27 /* r0 := (1 << 27) (UNPENDSVSET bit) */ /*<<<<<<<<<<<<<<<<<<<<<<< CRITICAL SECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<*/ #if (__TARGET_ARCH_THUMB == 3) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ CPSID i /* disable interrupts (set PRIMASK) */ #else /* M3/M4/M7 */ #if (__TARGET_FPU_VFP != 0) /* if VFP available... */ PUSH {r0,lr} /* ... push lr (EXC_RETURN) plus stack-aligner */ #endif /* VFP available */ MOVS r0,#QF_BASEPRI CPSID i /* selectively disable interrutps with BASEPRI */ MSR BASEPRI,r0 /* apply the workaround the Cortex-M7 erraturm */ CPSIE i /* 837070, see ARM-EPM-064408. */ #endif /* M3/M4/M7 */ /* The PendSV exception handler can be preempted by an interrupt, * which might pend PendSV exception again. The following write to * ICSR[27] un-pends any such spurious instance of PendSV. */ STR r1,[r3] /* ICSR[27] := 1 (unpend PendSV) */ /* The QK activator must be called in a Thread mode, while this code * executes in the Handler mode of the PendSV exception. The switch * to the Thread mode is accomplished by returning from PendSV using * a fabricated exception stack frame, where the return address is * QK_activate_(). * * NOTE: the QK activator is called with interrupts DISABLED and also * returns with interrupts DISABLED. */ LSRS r3,r1,#3 /* r3 := (r1 >> 3), set the T bit (new xpsr) */ LDR r2,=QK_activate_ /* address of QK_activate_ */ SUBS r2,r2,#1 /* align Thumb-address at halfword (new pc) */ LDR r1,=Thread_ret /* return address after the call (new lr) */ SUB sp,sp,#8*4 /* reserve space for exception stack frame */ ADD r0,sp,#5*4 /* r0 := 5 registers below the SP */ STM r0!,{r1-r3} /* save xpsr,pc,lr */ MOVS r0,#6 MVNS r0,r0 /* r0 := ~6 == 0xFFFFFFF9 */ BX r0 /* exception-return to the QK activator */ ALIGN /* align the code to 4-byte boundary */ } /***************************************************************************** * Thread_ret is a helper function executed when the QK activator returns. * * NOTE: Thread_ret does not execute in the PendSV context! * NOTE: Thread_ret executes entirely with interrupts DISABLED. *****************************************************************************/ __asm void Thread_ret(void) { /* After the QK activator returns, we need to resume the preempted * thread. However, this must be accomplished by a return-from-exception, * while we are still in the thread context. The switch to the exception * contex is accomplished by triggering the NMI exception. * NOTE: The NMI exception is triggered with nterrupts DISABLED, * because QK activator disables interrutps before return. */ PRESERVE8 /* preserve the 8-byte stack alignment */ /* before triggering the NMI exception, make sure that the * VFP stack frame will NOT be used... */ #if (__TARGET_FPU_VFP != 0) /* if VFP available... */ MRS r0,CONTROL /* r0 := CONTROL */ BICS r0,r0,#4 /* r0 := r0 & ~4 (FPCA bit) */ MSR CONTROL,r0 /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ ISB /* ISB after MSR CONTROL (ARM AN321,Sect.4.16) */ #endif /* VFP available */ /* trigger NMI to return to preempted task... * NOTE: The NMI exception is triggered with nterrupts DISABLED */ LDR r0,=0xE000ED04 /* Interrupt Control and State Register */ MOVS r1,#1 LSLS r1,r1,#31 /* r1 := (1 << 31) (NMI bit) */ STR r1,[r0] /* ICSR[31] := 1 (pend NMI) */ B . /* wait for preemption by NMI */ ALIGN /* align the code to 4-byte boundary */ } /***************************************************************************** * The NMI_Handler exception handler is used for returning back to the * interrupted task. The NMI exception simply removes its own interrupt * stack frame from the stack and returns to the preempted task using the * interrupt stack frame that must be at the top of the stack. * * NOTE: The NMI exception is entered with interrupts DISABLED, so it needs * to re-enable interrupts before it returns to the preempted task. *****************************************************************************/ __asm void NMI_Handler(void) { PRESERVE8 /* preserve the 8-byte stack alignment */ ADD sp,sp,#(8*4) /* remove one 8-register exception frame */ #if (__TARGET_ARCH_THUMB == 3) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ CPSIE i /* enable interrupts (clear PRIMASK) */ BX lr /* return to the preempted task */ #else /* M3/M4/M7 */ MOVS r0,#0 MSR BASEPRI,r0 /* enable interrupts (clear BASEPRI) */ #if (__TARGET_FPU_VFP != 0) /* if VFP available... */ POP {r0,pc} /* pop stack "aligner" and EXC_RETURN to PC */ #else /* no VFP */ BX lr /* return to the preempted task */ #endif /* no VFP */ #endif /* M3/M4/M7 */ ALIGN /* align the code to 4-byte boundary */ } ================================================ FILE: ports/arm-cm/qk/armclang/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, preemptive QK-nano kernel, ARM-CLANG * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (ARM-Clang/LLVM compiler) */ #define Q_NORETURN __attribute__ ((noreturn)) void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __asm volatile ("cpsid i") #define QF_INT_ENABLE() __asm volatile ("cpsie i") /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __asm volatile ("cpsid i") #define QF_PRIMASK_ENABLE() __asm volatile ("cpsie i") /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_SET_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_SET_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __builtin_clz(n_))) /* macro for setting the BASEPRI register */ #define QF_SET_BASEPRI(basepri_) __asm volatile (\ "msr BASEPRI,%0" :: "r" (basepri_) : ) #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST /* QK-nano initialization and ISR entry/exit */ #define QK_INIT() QK_init() void QK_init(void); #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ QF_INT_DISABLE(); \ if (QK_sched_() != 0U) { \ (*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (uint32_t)(1U << 28)); \ } \ QF_INT_ENABLE(); \ } while (false) #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qk/armclang/qkn_port.c ================================================ /** * @file * @brief QK-nano port to ARM Cortex-M, ARM-CLANG toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ /* prototypes --------------------------------------------------------------*/ void PendSV_Handler(void); void NMI_Handler(void); void Thread_ret(void); #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) #define NVIC_ICSR 0xE000ED04 /* helper macros to "stringify" values */ #define VAL(x) #x #define STRINGIFY(x) VAL(x) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QK_init() can be later * changed by the application-level code. */ void QK_init(void) { #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1 ? */ uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M) */ /* SCB_SYSPRI3: PendSV set to the lowest priority 0xFF */ SCB_SYSPRI[3] |= (0xFFU << 16); } /***************************************************************************** * The PendSV_Handler exception handler is used for handling context switch * and asynchronous preemption in QK. The use of the PendSV exception is * the recommended and most efficient method for performing context switches * with ARM Cortex-M. * * The PendSV exception should have the lowest priority in the whole system * (0xFF, see QK_init). All other exceptions and interrupts should have higher * priority. For example, for NVIC with 2 priority bits all interrupts and * exceptions must have numerical value of priority lower than 0xC0. In this * case the interrupt priority levels available to your applications are (in * the order from the lowest urgency to the highest urgency): 0x80, 0x40, 0x00. * * Also, *all* "kernel aware" ISRs in the QK application must call the * QK_ISR_EXIT() macro, which triggers PendSV when it detects a need for * a context switch or asynchronous preemption. * * Due to tail-chaining and its lowest priority, the PendSV exception will be * entered immediately after the exit from the *last* nested interrupt (or * exception). In QK, this is exactly the time when the QK activator needs to * handle the asynchronous preemption. *****************************************************************************/ __attribute__ ((naked)) void PendSV_Handler(void) { __asm volatile ( /* Prepare constants in registers before entering critical section */ " LDR r3,=" STRINGIFY(NVIC_ICSR) "\n" /* Interrupt Control and State */ " MOVS r1,#1 \n" " LSLS r1,r1,#27 \n" /* r0 := (1 << 27) (UNPENDSVSET bit) */ /*<<<<<<<<<<<<<<<<<<<<<<< CRITICAL SECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<*/ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSID i \n" /* disable interrupts (set PRIMASK) */ #else /* M3/M4/M7 */ #if (__ARM_FP != 0) /* if VFP available... */ " PUSH {r0,lr} \n" /* ... push lr plus stack-aligner */ #endif /* VFP available */ " MOVS r0,#" STRINGIFY(QF_BASEPRI) "\n" " CPSID i \n" /* disable interrutps with BASEPRI */ " MSR BASEPRI,r0 \n" /* apply the Cortex-M7 erraturm */ " CPSIE i \n" /* 837070, see ARM-EPM-064408. */ #endif /* M3/M4/M7 */ /* The PendSV exception handler can be preempted by an interrupt, * which might pend PendSV exception again. The following write to * ICSR[27] un-pends any such spurious instance of PendSV. */ " STR r1,[r3] \n" /* ICSR[27] := 1 (unpend PendSV) */ /* The QK activator must be called in a Thread mode, while this code * executes in the Handler mode of the PendSV exception. The switch * to the Thread mode is accomplished by returning from PendSV using * a fabricated exception stack frame, where the return address is * QK_activate_(). * * NOTE: the QK activator is called with interrupts DISABLED and also * returns with interrupts DISABLED. */ " LSRS r3,r1,#3 \n" /* r3 := (r1 >> 3), set the T bit (new xpsr) */ " LDR r2,=QK_activate_ \n" /* address of QK_activate_ */ " SUBS r2,r2,#1 \n" /* align Thumb-address at halfword (new pc) */ " LDR r1,=Thread_ret \n" /* return address after the call (new lr) */ " SUB sp,sp,#8*4 \n" /* reserve space for exception stack frame */ " ADD r0,sp,#5*4 \n" /* r0 := 5 registers below the SP */ " STM r0!,{r1-r3} \n" /* save xpsr,pc,lr */ " MOVS r0,#6 \n" " MVNS r0,r0 \n" /* r0 := ~6 == 0xFFFFFFF9 */ " BX r0 \n" /* exception-return to the QK activator */ ); } /***************************************************************************** * Thread_ret is a helper function executed when the QK activator returns. * * NOTE: Thread_ret does not execute in the PendSV context! * NOTE: Thread_ret executes entirely with interrupts DISABLED. *****************************************************************************/ __attribute__ ((naked)) void Thread_ret(void) { __asm volatile ( /* After the QK activator returns, we need to resume the preempted * thread. However, this must be accomplished by a return-from-exception, * while we are still in the thread context. The switch to the exception * contex is accomplished by triggering the NMI exception. * NOTE: The NMI exception is triggered with nterrupts DISABLED, * because QK activator disables interrutps before return. */ /* before triggering the NMI exception, make sure that the * VFP stack frame will NOT be used... */ #if (__ARM_FP != 0) /* if VFP available... */ " MRS r0,CONTROL \n" /* r0 := CONTROL */ " BICS r0,r0,#4 \n" /* r0 := r0 & ~4 (FPCA bit) */ " MSR CONTROL,r0 \n" /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ " ISB \n" /* ISB after MSR CONTROL (ARM AN321,Sect.4.16) */ #endif /* VFP available */ /* trigger NMI to return to preempted task... * NOTE: The NMI exception is triggered with nterrupts DISABLED */ " LDR r0,=0xE000ED04 \n" /* Interrupt Control and State Register */ " MOVS r1,#1 \n" " LSLS r1,r1,#31 \n" /* r1 := (1 << 31) (NMI bit) */ " STR r1,[r0] \n" /* ICSR[31] := 1 (pend NMI) */ " B . \n" /* wait for preemption by NMI */ ); } /***************************************************************************** * The NMI_Handler exception handler is used for returning back to the * interrupted task. The NMI exception simply removes its own interrupt * stack frame from the stack and returns to the preempted task using the * interrupt stack frame that must be at the top of the stack. * * NOTE: The NMI exception is entered with interrupts DISABLED, so it needs * to re-enable interrupts before it returns to the preempted task. *****************************************************************************/ __attribute__ ((naked)) void NMI_Handler(void) { __asm volatile ( " ADD sp,sp,#(8*4) \n" /* remove one 8-register exception frame */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSIE i \n" /* enable interrupts (clear PRIMASK) */ " BX lr \n" /* return to the preempted task */ #else /* M3/M4/M7 */ " MOVS r0,#0 \n" " MSR BASEPRI,r0 \n" /* enable interrupts (clear BASEPRI) */ #if (__ARM_FP != 0) /* if VFP available... */ " POP {r0,pc} \n" /* pop stack aligner and EXC_RETURN to PC */ #else /* no VFP */ " BX lr \n" /* return to the preempted task */ #endif /* no VFP */ #endif /* M3/M4/M7 */ ); } ================================================ FILE: ports/arm-cm/qk/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, preemptive QK-nano kernel, GNU-ARM * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* GNU-ARM function attribute for "no-return" function */ #define Q_NORETURN __attribute__ ((noreturn)) void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __asm volatile ("cpsid i") #define QF_INT_ENABLE() __asm volatile ("cpsie i") /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __asm volatile ("cpsid i") #define QF_PRIMASK_ENABLE() __asm volatile ("cpsie i") /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_SET_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_SET_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __builtin_clz(n_))) /* macro for setting the BASEPRI register */ #define QF_SET_BASEPRI(basepri_) __asm volatile (\ "msr BASEPRI,%0" :: "r" (basepri_) : ) #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST /* QK-nano initialization and ISR entry/exit */ #define QK_INIT() QK_init() void QK_init(void); #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ QF_INT_DISABLE(); \ if (QK_sched_() != 0U) { \ (*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (uint32_t)(1U << 28)); \ } \ QF_INT_ENABLE(); \ } while (false) #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qk/gnu/qkn_port.c ================================================ /** * @file * @brief QK-nano port to ARM Cortex-M, GNU-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ /* prototypes --------------------------------------------------------------*/ void PendSV_Handler(void); void NMI_Handler(void); void Thread_ret(void); #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) #define NVIC_ICSR 0xE000ED04 /* helper macros to "stringify" values */ #define VAL(x) #x #define STRINGIFY(x) VAL(x) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QK_init() can be later * changed by the application-level code. */ void QK_init(void) { #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M) */ /* SCB_SYSPRI3: PendSV set to the lowest priority 0xFF */ SCB_SYSPRI[3] |= (0xFFU << 16); } /***************************************************************************** * The PendSV_Handler exception handler is used for handling context switch * and asynchronous preemption in QK. The use of the PendSV exception is * the recommended and most efficient method for performing context switches * with ARM Cortex-M. * * The PendSV exception should have the lowest priority in the whole system * (0xFF, see QK_init). All other exceptions and interrupts should have higher * priority. For example, for NVIC with 2 priority bits all interrupts and * exceptions must have numerical value of priority lower than 0xC0. In this * case the interrupt priority levels available to your applications are (in * the order from the lowest urgency to the highest urgency): 0x80, 0x40, 0x00. * * Also, *all* "kernel aware" ISRs in the QK application must call the * QK_ISR_EXIT() macro, which triggers PendSV when it detects a need for * a context switch or asynchronous preemption. * * Due to tail-chaining and its lowest priority, the PendSV exception will be * entered immediately after the exit from the *last* nested interrupt (or * exception). In QK, this is exactly the time when the QK activator needs to * handle the asynchronous preemption. * * NOTE: * The inline GNU assembler does not accept mnemonics MOVS, LSRS and ADDS, * but for Cortex-M0/M0+/M1 the mnemonics MOV, LSR and ADD always set the * condition flags in the PSR. *****************************************************************************/ __attribute__ ((naked, optimize("-fno-stack-protector"))) void PendSV_Handler(void) { __asm volatile ( /* Prepare constants in registers before entering critical section */ " LDR r3,=" STRINGIFY(NVIC_ICSR) "\n" /* Interrupt Control and State */ " MOV r1,#1 \n" " LSL r1,r1,#27 \n" /* r0 := (1 << 27) (UNPENDSVSET bit) */ /*<<<<<<<<<<<<<<<<<<<<<<< CRITICAL SECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<*/ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSID i \n" /* disable interrupts (set PRIMASK) */ #else /* M3/M4/M7 */ #if (__ARM_FP != 0) /* if VFP available... */ " PUSH {r0,lr} \n" /* ... push lr plus stack-aligner */ #endif /* VFP available */ " MOV r0,#" STRINGIFY(QF_BASEPRI) "\n" " CPSID i \n" /* disable interrutps with BASEPRI */ " MSR BASEPRI,r0 \n" /* apply the Cortex-M7 erraturm */ " CPSIE i \n" /* 837070, see ARM-EPM-064408. */ #endif /* M3/M4/M7 */ /* The PendSV exception handler can be preempted by an interrupt, * which might pend PendSV exception again. The following write to * ICSR[27] un-pends any such spurious instance of PendSV. */ " STR r1,[r3] \n" /* ICSR[27] := 1 (unpend PendSV) */ /* The QK activator must be called in a Thread mode, while this code * executes in the Handler mode of the PendSV exception. The switch * to the Thread mode is accomplished by returning from PendSV using * a fabricated exception stack frame, where the return address is * QK_activate_(). * * NOTE: the QK activator is called with interrupts DISABLED and also * returns with interrupts DISABLED. */ " LSR r3,r1,#3 \n" /* r3 := (r1 >> 3), set the T bit (new xpsr) */ " LDR r2,=QK_activate_ \n" /* address of QK_activate_ */ " SUB r2,r2,#1 \n" /* align Thumb-address at halfword (new pc) */ " LDR r1,=Thread_ret \n" /* return address after the call (new lr) */ " SUB sp,sp,#8*4 \n" /* reserve space for exception stack frame */ " ADD r0,sp,#5*4 \n" /* r0 := 5 registers below the SP */ " STM r0!,{r1-r3} \n" /* save xpsr,pc,lr */ " MOV r0,#6 \n" " MVN r0,r0 \n" /* r0 := ~6 == 0xFFFFFFF9 */ " BX r0 \n" /* exception-return to the QK activator */ ); } /***************************************************************************** * Thread_ret is a helper function executed when the QK activator returns. * * NOTE: Thread_ret does not execute in the PendSV context! * NOTE: Thread_ret executes entirely with interrupts DISABLED. *****************************************************************************/ __attribute__ ((naked, optimize("-fno-stack-protector"))) void Thread_ret(void) { __asm volatile ( /* After the QK activator returns, we need to resume the preempted * thread. However, this must be accomplished by a return-from-exception, * while we are still in the thread context. The switch to the exception * contex is accomplished by triggering the NMI exception. * NOTE: The NMI exception is triggered with nterrupts DISABLED, * because QK activator disables interrutps before return. */ /* before triggering the NMI exception, make sure that the * VFP stack frame will NOT be used... */ #if (__ARM_FP != 0) /* if VFP available... */ " MRS r0,CONTROL \n" /* r0 := CONTROL */ " BICS r0,r0,#4 \n" /* r0 := r0 & ~4 (FPCA bit) */ " MSR CONTROL,r0 \n" /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ " ISB \n" /* ISB after MSR CONTROL (ARM AN321,Sect.4.16) */ #endif /* VFP available */ /* trigger NMI to return to preempted task... * NOTE: The NMI exception is triggered with nterrupts DISABLED */ " LDR r0,=0xE000ED04 \n" /* Interrupt Control and State Register */ " MOV r1,#1 \n" " LSL r1,r1,#31 \n" /* r1 := (1 << 31) (NMI bit) */ " STR r1,[r0] \n" /* ICSR[31] := 1 (pend NMI) */ " B . \n" /* wait for preemption by NMI */ ); } /***************************************************************************** * The NMI_Handler exception handler is used for returning back to the * interrupted task. The NMI exception simply removes its own interrupt * stack frame from the stack and returns to the preempted task using the * interrupt stack frame that must be at the top of the stack. * * NOTE: The NMI exception is entered with interrupts DISABLED, so it needs * to re-enable interrupts before it returns to the preempted task. *****************************************************************************/ __attribute__ ((naked, optimize("-fno-stack-protector"))) void NMI_Handler(void) { __asm volatile ( " ADD sp,sp,#(8*4) \n" /* remove one 8-register exception frame */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSIE i \n" /* enable interrupts (clear PRIMASK) */ " BX lr \n" /* return to the preempted task */ #else /* M3/M4/M7 */ " MOV r0,#0 \n" " MSR BASEPRI,r0 \n" /* enable interrupts (clear BASEPRI) */ #if (__ARM_FP != 0) /* if VFP available... */ " POP {r0,pc} \n" /* pop stack aligner and EXC_RETURN to PC */ #else /* no VFP */ " BX lr \n" /* return to the preempted task */ #endif /* no VFP */ #endif /* M3/M4/M7 */ ); } ================================================ FILE: ports/arm-cm/qk/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, preemptive QK-nano kernel, IAR-ARM * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (IAR compiler) */ #define Q_NORETURN __noreturn void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __disable_interrupt() #define QF_PRIMASK_ENABLE() __enable_interrupt() /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() __set_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() __set_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __CLZ(n_))) #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST /* QK-nano initialization and ISR entry/exit */ #define QK_INIT() QK_init() void QK_init(void); /* prototype needed for IAR "Multi-file Compilation" */ void Thread_ret(void); #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ QF_INT_DISABLE(); \ if (QK_sched_() != 0U) { \ (*Q_UINT2PTR_CAST(uint32_t, 0xE000ED04U) = (uint32_t)(1U << 28)); \ } \ QF_INT_ENABLE(); \ } while (false) #include /* intrinsic IAR functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qk/iar/qkn_port.c ================================================ /** * @file * @brief QK-nano port to ARM Cortex-M, IAR-ARM toolset * @cond ****************************************************************************** * Last updated for version 6.7.0 * Last updated on 2019-12-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ /* prototypes --------------------------------------------------------------*/ void PendSV_Handler(void); void NMI_Handler(void); #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) #define NVIC_ICSR 0xE000ED04 /* helper macros to "stringify" values */ #define VAL(x) #x #define STRINGIFY(x) VAL(x) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QK port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QK_init() can be later * changed by the application-level code. */ void QK_init(void) { #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1 ? */ uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M) */ /* SCB_SYSPRI3: PendSV set to the lowest priority 0xFF */ SCB_SYSPRI[3] |= (0xFFU << 16); } /***************************************************************************** * The PendSV_Handler exception handler is used for handling context switch * and asynchronous preemption in QK. The use of the PendSV exception is * the recommended and most efficient method for performing context switches * with ARM Cortex-M. * * The PendSV exception should have the lowest priority in the whole system * (0xFF, see QK_init). All other exceptions and interrupts should have higher * priority. For example, for NVIC with 2 priority bits all interrupts and * exceptions must have numerical value of priority lower than 0xC0. In this * case the interrupt priority levels available to your applications are (in * the order from the lowest urgency to the highest urgency): 0x80, 0x40, 0x00. * * Also, *all* "kernel aware" ISRs in the QK application must call the * QK_ISR_EXIT() macro, which triggers PendSV when it detects a need for * a context switch or asynchronous preemption. * * Due to tail-chaining and its lowest priority, the PendSV exception will be * entered immediately after the exit from the *last* nested interrupt (or * exception). In QK, this is exactly the time when the QK activator needs to * handle the asynchronous preemption. *****************************************************************************/ __stackless void PendSV_Handler(void) { __asm volatile ( /* Prepare constants in registers before entering critical section */ " LDR r3,=" STRINGIFY(NVIC_ICSR) "\n" /* Interrupt Control and State */ " MOVS r1,#1 \n" " LSLS r1,r1,#27 \n" /* r0 := (1 << 27) (UNPENDSVSET bit) */ /*<<<<<<<<<<<<<<<<<<<<<<< CRITICAL SECTION BEGIN <<<<<<<<<<<<<<<<<<<<<<<<*/ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSID i \n" /* disable interrupts (set PRIMASK) */ #else /* M3/M4/M7 */ #if (__ARM_FP != 0) /* if VFP available... */ " PUSH {r0,lr} \n" /* ... push lr plus stack-aligner */ #endif /* VFP available */ " MOVS r0,#" STRINGIFY(QF_BASEPRI) "\n" " CPSID i \n" /* disable interrutps with BASEPRI */ " MSR BASEPRI,r0 \n" /* apply the Cortex-M7 erraturm */ " CPSIE i \n" /* 837070, see ARM-EPM-064408. */ #endif /* M3/M4/M7 */ /* The PendSV exception handler can be preempted by an interrupt, * which might pend PendSV exception again. The following write to * ICSR[27] un-pends any such spurious instance of PendSV. */ " STR r1,[r3] \n" /* ICSR[27] := 1 (unpend PendSV) */ /* The QK activator must be called in a Thread mode, while this code * executes in the Handler mode of the PendSV exception. The switch * to the Thread mode is accomplished by returning from PendSV using * a fabricated exception stack frame, where the return address is * QK_activate_(). * * NOTE: the QK activator is called with interrupts DISABLED and also * returns with interrupts DISABLED. */ " LSRS r3,r1,#3 \n" /* r3 := (r1 >> 3), set the T bit (new xpsr) */ " LDR r2,=QK_activate_ \n" /* address of QK_activate_ */ " SUBS r2,r2,#1 \n" /* align Thumb-address at halfword (new pc) */ " LDR r1,=Thread_ret \n" /* return address after the call (new lr) */ " SUB sp,sp,#8*4 \n" /* reserve space for exception stack frame */ " ADD r0,sp,#5*4 \n" /* r0 := 5 registers below the SP */ " STM r0!,{r1-r3} \n" /* save xpsr,pc,lr */ " MOVS r0,#6 \n" " MVNS r0,r0 \n" /* r0 := ~6 == 0xFFFFFFF9 */ " BX r0 \n" /* exception-return to the QK activator */ ); } /***************************************************************************** * Thread_ret is a helper function executed when the QK activator returns. * * NOTE: Thread_ret does not execute in the PendSV context! * NOTE: Thread_ret executes entirely with interrupts DISABLED. *****************************************************************************/ __stackless void Thread_ret(void) { __asm volatile ( /* After the QK activator returns, we need to resume the preempted * thread. However, this must be accomplished by a return-from-exception, * while we are still in the thread context. The switch to the exception * contex is accomplished by triggering the NMI exception. * NOTE: The NMI exception is triggered with nterrupts DISABLED, * because QK activator disables interrutps before return. */ /* before triggering the NMI exception, make sure that the * VFP stack frame will NOT be used... */ #if (__ARM_FP != 0) /* if VFP available... */ " MRS r0,CONTROL \n" /* r0 := CONTROL */ " BICS r0,r0,#4 \n" /* r0 := r0 & ~4 (FPCA bit) */ " MSR CONTROL,r0 \n" /* CONTROL := r0 (clear CONTROL[2] FPCA bit) */ " ISB \n" /* ISB after MSR CONTROL (ARM AN321,Sect.4.16) */ #endif /* VFP available */ /* trigger NMI to return to preempted task... * NOTE: The NMI exception is triggered with nterrupts DISABLED */ " LDR r0,=0xE000ED04 \n" /* Interrupt Control and State Register */ " MOVS r1,#1 \n" " LSLS r1,r1,#31 \n" /* r1 := (1 << 31) (NMI bit) */ " STR r1,[r0] \n" /* ICSR[31] := 1 (pend NMI) */ " B . \n" /* wait for preemption by NMI */ ); } /***************************************************************************** * The NMI_Handler exception handler is used for returning back to the * interrupted task. The NMI exception simply removes its own interrupt * stack frame from the stack and returns to the preempted task using the * interrupt stack frame that must be at the top of the stack. * * NOTE: The NMI exception is entered with interrupts DISABLED, so it needs * to re-enable interrupts before it returns to the preempted task. *****************************************************************************/ __stackless void NMI_Handler(void) { __asm volatile ( " ADD sp,sp,#(8*4) \n" /* remove one 8-register exception frame */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 (v6-M, v6S-M)? */ " CPSIE i \n" /* enable interrupts (clear PRIMASK) */ " BX lr \n" /* return to the preempted task */ #else /* M3/M4/M7 */ " MOVS r0,#0 \n" " MSR BASEPRI,r0 \n" /* enable interrupts (clear BASEPRI) */ #if (__ARM_FP != 0) /* if VFP available... */ " POP {r0,pc} \n" /* pop stack aligner and EXC_RETURN to PC */ #else /* no VFP */ " BX lr \n" /* return to the preempted task */ #endif /* no VFP */ #endif /* M3/M4/M7 */ ); } ================================================ FILE: ports/arm-cm/qv/arm/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, cooperative QV-nano kernel, ARM-KEIL toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (not supported in ARM-Keil compiler 5) */ #define Q_NORETURN __declspec(noreturn) void /* QF interrupt disable/enable and log2()... */ #if (__TARGET_ARCH_THUMB == 3) /* Cortex-M0/M0+/M1(v6-M, v6S-M)? */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __disable_irq() #define QF_INT_ENABLE() __enable_irq() /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ __wfi(); \ QF_INT_ENABLE(); \ } while (false) #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __disable_irq() #define QF_PRIMASK_ENABLE() __enable_irq() /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_set_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_set_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ QF_PRIMASK_DISABLE(); \ QF_INT_ENABLE(); \ __wfi(); \ QF_PRIMASK_ENABLE(); \ } while (false) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __clz(n_))) /* inline function for setting the BASEPRI register */ static __inline void QF_set_BASEPRI(unsigned basePri) { register unsigned volatile __regBasePri __asm("basepri"); __regBasePri = basePri; } /* initialization of the QV kernel for Cortex-M3/M4 */ #define QV_INIT() QV_init() void QV_init(void); #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qv/arm/qvn_port.c ================================================ /** * @file * @brief QV-nano port to ARM Cortex-M, ARM-KEIL toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #if (__TARGET_ARCH_THUMB != 3) /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QV port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QV_init() can be later * changed by the application-level code. */ void QV_init(void) { uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); } #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ ================================================ FILE: ports/arm-cm/qv/armclang/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, cooperative QV kernel, ARM-CLANG toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (ARM-Clang/LLVM compiler) */ #define Q_NORETURN __attribute__ ((noreturn)) void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __asm volatile ("cpsid i") #define QF_INT_ENABLE() __asm volatile ("cpsie i") /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ __asm volatile ("wfi"); \ QF_INT_ENABLE(); \ } while (false) #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __asm volatile ("cpsid i") #define QF_PRIMASK_ENABLE() __asm volatile ("cpsie i") /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_SET_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_SET_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ QF_PRIMASK_DISABLE(); \ QF_INT_ENABLE(); \ __asm volatile ("wfi"); \ QF_PRIMASK_ENABLE(); \ } while (false) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __builtin_clz(n_))) /* macro for setting the BASEPRI register */ #define QF_SET_BASEPRI(basepri_) __asm volatile (\ "msr BASEPRI,%0" :: "r" (basepri_) : ) /* initialization of the QV kernel for Cortex-M3/M4/M7 */ #define QV_INIT() QV_init() void QV_init(void); #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qv/armclang/qvn_port.c ================================================ /** * @file * @brief QV-nano port to ARM Cortex-M, ARM-CLANG toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QV port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QV_init() can be later * changed by the application-level code. */ void QV_init(void) { uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); } #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ ================================================ FILE: ports/arm-cm/qv/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, cooperative QV-nano kernel, GNU-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* GNU-ARM function attribute for "no-return" function */ #define Q_NORETURN __attribute__ ((noreturn)) void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __asm volatile ("cpsid i") #define QF_INT_ENABLE() __asm volatile ("cpsie i") /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ __asm volatile ("wfi"); \ QF_INT_ENABLE(); \ } while (false) #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __asm volatile ("cpsid i") #define QF_PRIMASK_ENABLE() __asm volatile ("cpsie i") /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() QF_SET_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() QF_SET_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ QF_PRIMASK_DISABLE(); \ QF_INT_ENABLE(); \ __asm volatile ("wfi"); \ QF_PRIMASK_ENABLE(); \ } while (false) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __builtin_clz(n_))) /* macro for setting the BASEPRI register */ #define QF_SET_BASEPRI(basepri_) __asm volatile (\ "msr BASEPRI,%0" :: "r" (basepri_) : ) /* initialization of the QV kernel for Cortex-M3/M4 */ #define QV_INIT() QV_init() void QV_init(void); #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qv/gnu/qvn_port.c ================================================ /** * @file * @brief QV-nano port to ARM Cortex-M, GNU-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QV port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QV_init() can be later * changed by the application-level code. */ void QV_init(void) { uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); } #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ ================================================ FILE: ports/arm-cm/qv/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM Cortex-M, cooperative QV-nano kernel, IAR-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! no-return function specifier (IAR compiler) */ #define Q_NORETURN __noreturn void /* QF interrupt disable/enable and log2()... */ #if (__ARM_ARCH == 6) /* Cortex-M0/M0+/M1 ?, see NOTE1 */ /* Cortex-M0/M0+/M1(v6-M, v6S-M) interrupt disabling policy, see NOTE2 */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE1 */ #define QF_AWARE_ISR_CMSIS_PRI 0 /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ __WFI(); \ QF_INT_ENABLE(); \ } while (false) #else /* Cortex-M3/M4, see NOTE2 */ /* Cortex-M3/M4 alternative interrupt disabling with PRIMASK */ #define QF_PRIMASK_DISABLE() __disable_interrupt() #define QF_PRIMASK_ENABLE() __enable_interrupt() /* Cortex-M3/M4 interrupt disabling policy */ #define QF_INT_DISABLE() __set_BASEPRI(QF_BASEPRI) #define QF_INT_ENABLE() __set_BASEPRI(0U) /* BASEPRI threshold for "QF-aware" interrupts, see NOTE2 */ #define QF_BASEPRI 0x3F /* QF-aware ISR priority for CMSIS function NVIC_SetPriority(), NOTE3 */ #define QF_AWARE_ISR_CMSIS_PRI (QF_BASEPRI >> (8 - __NVIC_PRIO_BITS)) /* macro to put the CPU to sleep inside QV_onIdle() */ #define QV_CPU_SLEEP() do { \ QF_PRIMASK_DISABLE(); \ QF_INT_ENABLE(); \ __WFI(); \ QF_PRIMASK_ENABLE(); \ } while (false) /* Cortex-M3/M4 provide the CLZ instruction for fast LOG2 */ #define QF_LOG2(n_) ((uint_fast8_t)(32U - __CLZ(n_))) /* initialization of the QV kernel for Cortex-M3/M4 */ #define QV_INIT() QV_init() void QV_init(void); #endif /* interrupt nesting policy for ISR level (ISRs can nest) */ #define QF_ISR_NEST #include /* intrinsic IAR functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel interface */ /***************************************************************************** * NOTE1: * On Cortex-M0/M0+/M1 (architecture v6-M, v6S-M), the interrupt disabling * policy uses the PRIMASK register to disable interrupts globally. The * QF_AWARE_ISR_CMSIS_PRI level is zero, meaning that all interrupts are * "kernel-aware". * * NOTE2: * On Cortex-M3/M4, the interrupt disable/enable policy uses the BASEPRI * register (which is not implemented in Cortex-M0/M0+/M1) to disable * interrupts only with priority lower than the level specified by the * QF_BASEPRI macro. The interrupts with priorities above QF_BASEPRI (i.e., * with numerical priority values lower than QF_BASEPRI) are not disabled in * this method. These free-running interrupts are not allowed to call any QF * services, because QF is not aware of these interrupts. Coversely, only * "QF-aware" interrupts, with numerical values of priorities eqal to or * higher than QF_BASEPRI, can call QF services. * * NOTE3: * The QF_AWARE_ISR_CMSIS_PRI macro is useful as an offset for enumerating * the QF-aware interrupt priority levels in the applications, whereas the * numerical values of the QF-aware interrupts must be greater or equal to * QF_AWARE_ISR_CMSIS_PRI. The enumerated values based on * QF_AWARE_ISR_CMSIS_PRI can be passed directly to the CMSIS function * NVIC_SetPriority(), which shifts them by (8 - __NVIC_PRIO_BITS) into the * correct bit position, while __NVIC_PRIO_BITS is the CMSIS macro defining * the number of implemented priority bits in the NVIC. Please note that * the macro QF_AWARE_ISR_CMSIS_PRI is intended only for applications and * is not used inside the QF port, which remains generic and not dependent * on the number of implemented priority bits in the NVIC. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm-cm/qv/iar/qvn_port.c ================================================ /** * @file * @brief QV-nano port to ARM Cortex-M, IAR-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #if (__ARM_ARCH != 6) /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ #define SCnSCB_ICTR ((uint32_t volatile *)0xE000E004) #define SCB_SYSPRI ((uint32_t volatile *)0xE000ED14) #define NVIC_IP ((uint32_t volatile *)0xE000E400) /* * Initialize the exception priorities and IRQ priorities to safe values. * * Description: * On Cortex-M3/M4, this QV port disables interrupts by means of the * BASEPRI register. However, this method cannot disable interrupt * priority zero, which is the default for all interrupts out of reset. * The following code changes the SysTick priority and all IRQ priorities * to the safe value QF_BASEPRI, wich the QF critical section can disable. * This avoids breaching of the QF critical sections in case the * application programmer forgets to explicitly set priorities of all * "kernel aware" interrupts. * * The interrupt priorities established in QV_init() can be later * changed by the application-level code. */ void QV_init(void) { uint32_t n; /* set exception priorities to QF_BASEPRI... * SCB_SYSPRI1: Usage-fault, Bus-fault, Memory-fault */ SCB_SYSPRI[1] |= (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; /* SCB_SYSPRI2: SVCall */ SCB_SYSPRI[2] |= (QF_BASEPRI << 24); /* SCB_SYSPRI3: SysTick, PendSV, Debug */ SCB_SYSPRI[3] |= (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | QF_BASEPRI; /* set all implemented IRQ priories to QF_BASEPRI... */ n = 8U + ((*SCnSCB_ICTR & 0x7U) << 3); /* (# NVIC_PRIO registers)/4 */ do { --n; NVIC_IP[n] = (QF_BASEPRI << 24) | (QF_BASEPRI << 16) | (QF_BASEPRI << 8) | QF_BASEPRI; } while (n != 0); } #endif /* NOT Cortex-M0/M0+/M1(v6-M, v6S-M)? */ ================================================ FILE: ports/arm7-9/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm7-9.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/arm7-9/qk/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm7-9.html#arm7-9_qk IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/arm7-9/qk/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM7-9, QK-nano kernel, GNU-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* fast unconditional interrupt disabling/enabling for ARM state, NOTE1 */ #define QF_INT_DISABLE() \ __asm volatile ("MSR cpsr_c,#(0x1F | 0x80)" ::: "cc") #define QF_INT_ENABLE() \ __asm volatile ("MSR cpsr_c,#(0x1F)" ::: "cc") /* interrupt disabling policy for ISR level for ARM state */ #define QF_ISR_NEST #define QF_ISR_STAT_TYPE unsigned long #define QF_ISR_DISABLE(stat_) do { \ __asm volatile ("MRS %0,cpsr" : "=r" (stat_) :: "cc"); \ QF_INT_DISABLE(); \ } while (false) #define QF_ISR_RESTORE(stat_) __set_CPSR(stat_) /* QK-nano initialization and ISR entry/exit */ void QK_irq(void); void BSP_irq(void); /* void BSP_fiq(void); see NOTE1 */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ void QF_reset(void); void QF_undef(void); void QF_swi(void); void QF_pAbort(void); void QF_dAbort(void); void QF_reserved(void); void QF_unused(void); /***************************************************************************** * NOTE1: * The disabling/enabling of interrutps is only defined for the ARM state, * which means that any code that disables/enables interrutps must be compiled * to ARM. The policy is to disable only the IRQ and NOT to disable the FIQ, * which means that FIQ is a "QF-unaware" from the kernel perspective. This means * that FIQ has "zero latency", but it also means that FIQ *cannot* call any * QP services. Specifically FIQ cannot post or publish events. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm7-9/qk/gnu/qkn_port.s ================================================ /***************************************************************************** * Product: QK port to ARM7-9, GNU-ARM assembler * Last Updated for Version: 6.3.6 * Date of the Last Update: 2018-10-29 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * https://www.state-machine.com * mailto:info@state-machine.com *****************************************************************************/ .equ NO_IRQ, 0x80 /* mask to disable interrupts (IRQ) */ .equ NO_FIQ, 0x40 /* mask to disable interrupts (FIQ) */ .equ FIQ_MODE, 0x11 .equ IRQ_MODE, 0x12 .equ SYS_MODE, 0x1F /* NOTE: keep in synch with the QK_Attr struct in "qk.h" !!! */ .equ QK_INT_NEST, 4 .text .arm /* use the special section (.text.fastcode), to enable fine-tuning * of the placement of this section inside the linker script */ .section .text.fastcode /***************************************************************************** * unsigned int QF_int_disable_SYS(void); */ .global QF_int_disable_SYS .func QF_int_disable_SYS QF_int_disable_SYS: MRS r0,cpsr /* get the original CPSR in r0 to return */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* disable IRQ only, FIQ enabled! */ BX lr /* return the original CPSR in r0 */ .size QF_int_disable_SYS, . - QF_int_disable_SYS .endfunc /***************************************************************************** * void QF_int_enable_SYS(unsigned int key); */ .global QF_int_enable_SYS .func QF_int_enable_SYS QF_int_enable_SYS: MSR cpsr_c,r0 /* restore the original CPSR from r0 */ BX lr /* return to ARM or THUMB */ .size QF_int_enable_SYS, . - QF_int_enable_SYS .endfunc /***************************************************************************** * void QK_init(); */ .global QK_init .func QK_init QK_init: BX lr /* return to ARM or THUMB */ .size QK_init, . - QK_init .endfunc /***************************************************************************** * void QK_irq(void); */ .global QK_irq .func QK_irq .align 3 QK_irq: /* IRQ entry {{{ */ MOV r13,r0 /* save r0 in r13_IRQ */ SUB r0,lr,#4 /* put return address in r0_SYS */ MOV lr,r1 /* save r1 in r14_IRQ (lr) */ MRS r1,spsr /* put the SPSR in r1_SYS */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* SYSTEM, no IRQ, but FIQ enabled! */ STMFD sp!,{r0,r1} /* save SPSR and PC on SYS stack */ STMFD sp!,{r2-r3,r12,lr} /* save APCS-clobbered regs on SYS stack */ MOV r0,sp /* make the sp_SYS visible to IRQ mode */ SUB sp,sp,#(2*4) /* make room for stacking (r0_SYS, r1_SYS) */ MSR cpsr_c,#(IRQ_MODE | NO_IRQ) /* IRQ mode, IRQ disabled */ STMFD r0!,{r13,r14} /* finish saving the context (r0_SYS,r1_SYS)*/ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* SYSTEM mode, IRQ disabled */ /* IRQ entry }}} */ LDR r0,=QK_attr_ /* load address in already saved r0 */ LDRB r12,[r0,#QK_INT_NEST] /* load QK_attr_.intNest into saved r12 */ ADD r12,r12,#1 /* increment the nesting level */ STRB r12,[r0,#QK_INT_NEST] /* store the value in QK_attr_.intNest */ /* MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; enable FIQ * NOTE: BSP_irq might re-enable IRQ interrupts (the FIQ is enabled * already), if IRQs are prioritized by the interrupt controller. */ LDR r12,=BSP_irq MOV lr,pc /* copy the return address to link register */ BX r12 /* call the C IRQ-handler (ARM/THUMB) */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* make sure IRQs are disabled */ LDR r0,=QK_attr_ /* load address */ LDRB r12,[r0,#QK_INT_NEST] /* load QK_attr_.intNest into saved r12 */ SUBS r12,r12,#1 /* decrement the nesting level */ STRB r12,[r0,#QK_INT_NEST] /* store the value in QK_attr_.intNest */ BNE QK_irq_exit /* branch if interrupt nesting not zero */ LDR r12,=QK_sched_ MOV lr,pc /* copy the return address to link register */ BX r12 /* call QK_sched_ (ARM/THUMB) */ CMP r0,#0 /* check the returned priority */ BEQ QK_irq_exit /* branch if priority zero */ LDR r12,=QK_activate_ MOV lr,pc /* copy the return address to link register */ BX r12 /* call QK_activate_ (ARM/THUMB) */ QK_irq_exit: /* IRQ exit {{{ */ /* IRQ/FIQ disabled--return from scheduler */ MOV r0,sp /* make sp_SYS visible to IRQ mode */ ADD sp,sp,#(8*4) /* fake unstacking 8 registers from sp_SYS */ MSR cpsr_c,#(IRQ_MODE | NO_IRQ) /* IRQ mode, IRQ disabled */ MOV sp,r0 /* copy sp_SYS to sp_IRQ */ LDR r0,[sp,#(7*4)] /* load the saved SPSR from the stack */ MSR spsr_cxsf,r0 /* copy it into spsr_IRQ */ LDMFD sp,{r0-r3,r12,lr}^ /* unstack all saved USER/SYSTEM registers */ NOP /* can't access banked reg immediately */ LDR lr,[sp,#(6*4)] /* load return address from the SYS stack */ MOVS pc,lr /* return restoring CPSR from SPSR */ /* IRQ exit }}} */ .size QK_irq, . - QK_irq .endfunc /***************************************************************************** * void QF_reset(void); */ .global QF_reset .func QF_reset .align 3 QF_reset: LDR r0,=Csting_reset B QF_except .size QF_reset, . - QF_reset .endfunc /***************************************************************************** * void QF_undef(void); */ .global QF_undef .func QF_undef .align 3 QF_undef: LDR r0,=Csting_undef B QF_except .size QF_undef, . - QF_undef .endfunc /***************************************************************************** * void QF_swi(void); */ .global QF_swi .func QF_swi .align 3 QF_swi: LDR r0,=Csting_swi B QF_except .size QF_swi, . - QF_swi .endfunc /***************************************************************************** * void QF_pAbort(void); */ .global QF_pAbort .func QF_pAbort .align 3 QF_pAbort: LDR r0,=Csting_pAbort B QF_except .size QF_pAbort, . - QF_pAbort .endfunc /***************************************************************************** * void QF_dAbort(void); */ .global QF_dAbort .func QF_dAbort .align 3 QF_dAbort: LDR r0,=Csting_dAbort B QF_except .size QF_dAbort, . - QF_dAbort .endfunc /***************************************************************************** * void QF_reserved(void); */ .global QF_reserved .func QF_reserved .align 3 QF_reserved: LDR r0,=Csting_reserved B QF_except .size QF_reserved, . - QF_reserved .endfunc /***************************************************************************** * void QF_fiq_dummy(void); */ .global QF_fiq_dummy .func QF_fiq_dummy .align 3 QF_fiq_dummy: LDR r0,=Csting_fiq B QF_except .size QF_fiq_dummy, . - QF_fiq_dummy .endfunc /***************************************************************************** * void QF_except(void); */ .global QF_except .func QF_except .align 3 QF_except: /* r0 is set to the string with the exception name */ SUB r1,lr,#4 /* set line number to the exception address */ MSR cpsr_c,#(SYS_MODE | NO_IRQ | NO_FIQ) /* SYSTEM,IRQ/FIQ disabled */ LDR r12,=Q_onAssert MOV lr,pc /* store the return address */ BX r12 /* call the assertion-handler (ARM/THUMB) */ /* the assertion handler should not return, but in case it does * hang up the machine in this endless loop */ B . Csting_reset: .string "Reset" Csting_undef: .string "Undefined" Csting_swi: .string "Software Int" Csting_pAbort: .string "Prefetch Abort" Csting_dAbort: .string "Data Abort" Csting_reserved: .string "Reserved" Csting_fiq: .string "FIQ dummy" .size QF_except, . - QF_except .endfunc .end ================================================ FILE: ports/arm7-9/qk/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM7-9, QK-nano kernel, IAR-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* fast unconditional interrupt disabling/enabling for ARM state, NOTE2 */ #define QF_INT_DISABLE() __asm("MSR cpsr_c,#(0x1F | 0x80)") #define QF_INT_ENABLE() __asm("MSR cpsr_c,#(0x1F)") /* interrupt disabling policy for ISR level for ARM state */ #define QF_ISR_NEST #define QF_ISR_STAT_TYPE unsigned long #define QF_ISR_DISABLE(stat_) do { \ (stat_) = __get_CPSR(); \ QF_INT_DISABLE(); \ } while (false) #define QF_ISR_RESTORE(stat_) __set_CPSR(stat_) /* QK-nano initialization and ISR entry/exit */ void QK_irq(void); void BSP_irq(void); /* void BSP_fiq(void); see NOTE1 */ #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ void QF_reset(void); void QF_undef(void); void QF_swi(void); void QF_pAbort(void); void QF_dAbort(void); void QF_reserved(void); void QF_unused(void); /***************************************************************************** * NOTE1: * The disabling/enabling of interrutps is only defined for the ARM state, * which means that any code that disables/enables interrutps must be compiled * to ARM. The policy is to disable only the IRQ and NOT to disable the FIQ, * which means that FIQ is a "QF-unaware" from the kernel perspective. This means * that FIQ has "zero latency", but it also means that FIQ *cannot* call any * QP services. Specifically FIQ cannot post or publish events. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm7-9/qk/iar/qkn_port.s ================================================ ;----------------------------------------------------------------------------- ; Product: QK port to ARM7/9, IAR-ARM Assembler ; Last Updated for Version: 6.3.6 ; Date of the Last Update: 2018-10-29 ; ; Q u a n t u m L e a P s ; ------------------------ ; Modern Embedded Software ; ; Copyright (C) Quantum Leaps, LLC. All rights reserved. ; ; This program is open source software: you can redistribute it and/or ; modify it under the terms of the GNU General Public License as published ; by the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; Alternatively, this program may be distributed and modified under the ; terms of Quantum Leaps commercial licenses, which expressly supersede ; the GNU General Public License and are specifically designed for ; licensees interested in retaining the proprietary status of their code. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . ; ; Contact information: ; https://www.state-machine.com ; mailto:info@state-machine.com ;----------------------------------------------------------------------------- NO_IRQ DEFINE 0x80 ; mask to disable interrupts (FIQ and IRQ) NO_FIQ DEFINE 0x40 ; mask to disable interrupts (FIQ and IRQ) FIQ_MODE DEFINE 0x11 IRQ_MODE DEFINE 0x12 SYS_MODE DEFINE 0x1F ; NOTE: keep in synch with the QK_Attr struct in "qk.h" !!! QK_INT_NEST DEFINE 4 ;----------------------------------------------------------------------------- ; Interrupt disabling/enabling and QK initialization ;----------------------------------------------------------------------------- SECTION .textrw:DATA:NOROOT(2) PUBLIC QF_int_disable_SYS, QF_int_enable_SYS, QK_init CODE32 QF_int_disable_SYS: MRS r0,cpsr ; get the original CPSR in r0 to return MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; disable IRQ only, FIQ enabled! BX lr ; return the original CPSR in r0 QF_int_enable_SYS: MSR cpsr_c,r0 ; restore the original CPSR from r0 BX lr ; return to ARM or THUMB QK_init: BX lr ; return to ARM or THUMB ;----------------------------------------------------------------------------- ; IRQ assembly wrapper ;----------------------------------------------------------------------------- SECTION .textrw:DATA:NOROOT(2) PUBLIC QK_irq EXTERN BSP_irq EXTERN QK_attr_, QK_sched_, QK_activate_ CODE32 QK_irq: ; IRQ entry {{{ MOV r13,r0 ; save r0 in r13_IRQ SUB r0,lr,#4 ; put return address in r0_SYS MOV lr,r1 ; save r1 in r14_IRQ (lr) MRS r1,spsr ; put the SPSR in r1_SYS MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; SYSTEM, no IRQ, but FIQ enabled! STMFD sp!,{r0,r1} ; save SPSR and PC on SYS stack STMFD sp!,{r2-r3,r12,lr} ; save APCS-clobbered regs on SYS stack MOV r0,sp ; make the sp_SYS visible to IRQ mode SUB sp,sp,#(2*4) ; make room for stacking (r0_SYS, r1_SYS) MSR cpsr_c,#(IRQ_MODE | NO_IRQ) ; IRQ mode, IRQ disabled STMFD r0!,{r13,r14} ; finish saving the context (r0_SYS,r1_SYS) MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; SYSTEM mode, IRQ disabled ; IRQ entry }}} LDR r0,=QK_attr_ ; load address in already saved r0 LDRB r12,[r0,#QK_INT_NEST] ; load QK_attr_.intNest into saved r12 ADD r12,r12,#1 ; increment the nesting level STRB r12,[r0,#QK_INT_NEST] ; store the value in QK_attr_.intNest ; MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; enable FIQ ; NOTE: BSP_irq might re-enable IRQ interrupts (the FIQ is enabled ; already), if IRQs are prioritized by the interrupt controller. LDR r12,=BSP_irq MOV lr,pc ; copy the return address to link register BX r12 ; call the C IRQ-handler (ARM/THUMB) MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; make sure IRQs are disabled LDR r0,=QK_attr_ ; load address LDRB r12,[r0,#QK_INT_NEST] ; load QK_attr_.intNest into saved r12 SUBS r12,r12,#1 ; decrement the nesting level STRB r12,[r0,#QK_INT_NEST] ; store the value in QK_attr_.intNest BNE QK_irq_exit ; branch if interrupt nesting not zero LDR r12,=QK_sched_ MOV lr,pc ; copy the return address to link register BX r12 ; call QK_sched_ (ARM/THUMB) CMP r0,#0 ; check the returned priority BEQ QK_irq_exit ; branch if priority zero LDR r12,=QK_activate_ MOV lr,pc ; copy the return address to link register BX r12 ; call QK_activate_ (ARM/THUMB) QK_irq_exit: ; IRQ exit {{{ ; IRQ/FIQ disabled--return from scheduler MOV r0,sp ; make sp_SYS visible to IRQ mode ADD sp,sp,#(8*4) ; fake unstacking 8 registers from sp_SYS MSR cpsr_c,#(IRQ_MODE | NO_IRQ) ; IRQ mode, IRQ disabled MOV sp,r0 ; copy sp_SYS to sp_IRQ LDR r0,[sp,#(7*4)] ; load the saved SPSR from the stack MSR spsr_cxsf,r0 ; copy it into spsr_IRQ LDMFD sp,{r0-r3,r12,lr}^ ; unstack all saved USER/SYSTEM registers NOP ; can't access banked reg immediately LDR lr,[sp,#(6*4)] ; load return address from the SYS stack MOVS pc,lr ; return restoring CPSR from SPSR ; IRQ exit }}} ;----------------------------------------------------------------------------- ; Exception assembler wrappers ;----------------------------------------------------------------------------- PUBLIC QF_reset PUBLIC QF_undef PUBLIC QF_swi PUBLIC QF_pAbort PUBLIC QF_dAbort PUBLIC QF_reserved EXTERN Q_onAssert SECTION .text:CODE:NOROOT(2) CODE32 QF_reset: LDR r0,=Csting_reset B QF_except QF_undef: LDR r0,=Csting_undef B QF_except QF_swi: LDR r0,=Csting_swi B QF_except QF_pAbort: LDR r0,=Csting_pAbort B QF_except QF_dAbort: LDR r0,=Csting_dAbort B QF_except QF_reserved: LDR r0,=Csting_reserved B QF_except QF_except: ; r0 is set to the string with the exception name SUB r1,lr,#4 ; set line number to the exception address MSR cpsr_c,#(SYS_MODE | NO_IRQ | NO_FIQ) ; SYSTEM, IRQ/FIQ disabled LDR r12,=Q_onAssert MOV lr,pc ; store the return address BX r12 ; call the assertion-handler (ARM/THUMB) ; the assertion handler should not return, but in case it does ; hang up the machine in this endless loop B . LTORG ; strings enclosed in "" are zero-terminated Csting_reset: DC8 "Reset" Csting_undef: DC8 "Undefined" Csting_swi: DC8 "Software Int" Csting_pAbort: DC8 "Prefetch Abort" Csting_dAbort: DC8 "Data Abort" Csting_reserved: DC8 "Reserved" END ================================================ FILE: ports/arm7-9/qv/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/arm7-9.html#arm7-9_qv IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/arm7-9/qv/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM7-9, QV-nano kernel, GNU-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* fast unconditional interrupt disabling/enabling for ARM state, NOTE1 */ #define QF_INT_DISABLE() \ __asm volatile ("MSR cpsr_c,#(0x1F | 0x80)" ::: "cc") #define QF_INT_ENABLE() \ __asm volatile ("MSR cpsr_c,#(0x1F)" ::: "cc") /* interrupt disabling policy for ISR level for ARM state */ #define QF_ISR_NEST #define QF_ISR_STAT_TYPE unsigned long #define QF_ISR_DISABLE(stat_) do { \ __asm volatile ("MRS %0,cpsr" : "=r" (stat_) :: "cc"); \ QF_INT_DISABLE(); \ } while (false) #define QF_ISR_RESTORE(stat_) __set_CPSR(stat_) /* QV-nano initialization and ISR entry/exit */ void QV_irq(void); void BSP_irq(void); /* void BSP_fiq(void); see NOTE1 */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ void QF_reset(void); void QF_undef(void); void QF_swi(void); void QF_pAbort(void); void QF_dAbort(void); void QF_reserved(void); void QF_unused(void); /***************************************************************************** * NOTE1: * The disabling/enabling of interrutps is only defined for the ARM state, * which means that any code that disables/enables interrutps must be compiled * to ARM. The policy is to disable only the IRQ and NOT to disable the FIQ, * which means that FIQ is a "QF-unaware" from the kernel perspective. This means * that FIQ has "zero latency", but it also means that FIQ *cannot* call any * QP services. Specifically FIQ cannot post or publish events. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm7-9/qv/gnu/qvn_port.s ================================================ /** * @file * @brief QV port to ARM7-9, GNU-ARM assembler * @cond ****************************************************************************** * Last Updated for Version: 5.4.0 * Date of the Last Update: 2015-04-08 * * Q u a n t u m L e a P s * --------------------------- * innovating embedded systems * * Copyright (C) Quantum Leaps, LLC. state-machine.com. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * Web: www.state-machine.com * Email: info@state-machine.com ****************************************************************************** * @endcond */ .equ NO_IRQ, 0x80 /* mask to disable interrupts (IRQ) */ .equ NO_FIQ, 0x40 /* mask to disable interrupts (FIQ) */ .equ FIQ_MODE, 0x11 .equ IRQ_MODE, 0x12 .equ SYS_MODE, 0x1F .text .arm /* use the special section (.text.fastcode), to enable fine-tuning * of the placement of this section inside the linker script */ .section .text.fastcode /***************************************************************************** * unsigned int QF_int_disable_SYS(void); */ .global QF_int_disable_SYS .func QF_int_disable_SYS QF_int_disable_SYS: MRS r0,cpsr /* get the original CPSR in r0 to return */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* disable IRQ only, FIQ enabled! */ BX lr /* return the original CPSR in r0 */ .size QF_int_disable_SYS, . - QF_int_disable_SYS .endfunc /***************************************************************************** * void QF_int_enable_SYS(unsigned int key); */ .global QF_int_enable_SYS .func QF_int_enable_SYS QF_int_enable_SYS: MSR cpsr_c,r0 /* restore the original CPSR from r0 */ BX lr /* return to ARM or THUMB */ .size QF_int_enable_SYS, . - QF_int_enable_SYS .endfunc /***************************************************************************** * void QV_irq(void); */ .global QV_irq .func QV_irq .align 3 QV_irq: /* IRQ entry {{{ */ MOV r13,r0 /* save r0 in r13_IRQ */ SUB r0,lr,#4 /* put return address in r0_SYS */ MOV lr,r1 /* save r1 in r14_IRQ (lr) */ MRS r1,spsr /* put the SPSR in r1_SYS */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* SYSTEM, no IRQ, but FIQ enabled! */ STMFD sp!,{r0,r1} /* save SPSR and PC on SYS stack */ STMFD sp!,{r2-r3,r12,lr} /* save APCS-clobbered regs on SYS stack */ MOV r0,sp /* make the sp_SYS visible to IRQ mode */ SUB sp,sp,#(2*4) /* make room for stacking (r0_SYS, r1_SYS) */ MSR cpsr_c,#(IRQ_MODE | NO_IRQ) /* IRQ mode, IRQ disabled */ STMFD r0!,{r13,r14} /* finish saving the context (r0_SYS,r1_SYS)*/ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* SYSTEM mode, IRQ disabled */ /* IRQ entry }}} */ /* NOTE: BSP_irq might re-enable IRQ interrupts (the FIQ is enabled * already), if IRQs are prioritized by the interrupt controller. */ LDR r12,=BSP_irq MOV lr,pc /* copy the return address to link register */ BX r12 /* call the C IRQ-handler (ARM/THUMB) */ /* IRQ exit {{{ */ MSR cpsr_c,#(SYS_MODE | NO_IRQ) /* make sure IRQ are disabled */ MOV r0,sp /* make sp_SYS visible to IRQ mode */ ADD sp,sp,#(8*4) /* fake unstacking 8 registers from sp_SYS */ MSR cpsr_c,#(IRQ_MODE | NO_IRQ) /* IRQ mode, IRQ disabled */ MOV sp,r0 /* copy sp_SYS to sp_IRQ */ LDR r0,[sp,#(7*4)] /* load the saved SPSR from the stack */ MSR spsr_cxsf,r0 /* copy it into spsr_IRQ */ LDMFD sp,{r0-r3,r12,lr}^ /* unstack all saved USER/SYSTEM registers */ NOP /* can't access banked reg immediately */ LDR lr,[sp,#(6*4)] /* load return address from the SYS stack */ MOVS pc,lr /* return restoring CPSR from SPSR */ /* IRQ exit }}} */ .size QV_irq, . - QV_irq .endfunc /***************************************************************************** * void QF_reset(void); */ .global QF_reset .func QF_reset .align 3 QF_reset: LDR r0,=Csting_reset B QF_except .size QF_reset, . - QF_reset .endfunc /***************************************************************************** * void QF_undef(void); */ .global QF_undef .func QF_undef .align 3 QF_undef: LDR r0,=Csting_undef B QF_except .size QF_undef, . - QF_undef .endfunc /***************************************************************************** * void QF_swi(void); */ .global QF_swi .func QF_swi .align 3 QF_swi: LDR r0,=Csting_swi B QF_except .size QF_swi, . - QF_swi .endfunc /***************************************************************************** * void QF_pAbort(void); */ .global QF_pAbort .func QF_pAbort .align 3 QF_pAbort: LDR r0,=Csting_pAbort B QF_except .size QF_pAbort, . - QF_pAbort .endfunc /***************************************************************************** * void QF_dAbort(void); */ .global QF_dAbort .func QF_dAbort .align 3 QF_dAbort: LDR r0,=Csting_dAbort B QF_except .size QF_dAbort, . - QF_dAbort .endfunc /***************************************************************************** * void QF_reserved(void); */ .global QF_reserved .func QF_reserved .align 3 QF_reserved: LDR r0,=Csting_reserved B QF_except .size QF_reserved, . - QF_reserved .endfunc /***************************************************************************** * void QF_fiq_dummy(void); */ .global QF_fiq_dummy .func QF_fiq_dummy .align 3 QF_fiq_dummy: LDR r0,=Csting_fiq B QF_except .size QF_fiq_dummy, . - QF_fiq_dummy .endfunc /***************************************************************************** * void QF_except(void); */ .global QF_except .func QF_except .align 3 QF_except: /* r0 is set to the string with the exception name */ SUB r1,lr,#4 /* set line number to the exception address */ MSR cpsr_c,#(SYS_MODE | NO_IRQ | NO_FIQ) /* SYSTEM,IRQ/FIQ disabled */ LDR r12,=Q_onAssert MOV lr,pc /* store the return address */ BX r12 /* call the assertion-handler (ARM/THUMB) */ /* the assertion handler should not return, but in case it does * hang up the machine in this endless loop */ B . Csting_reset: .string "Reset" Csting_undef: .string "Undefined" Csting_swi: .string "Software Int" Csting_pAbort: .string "Prefetch Abort" Csting_dAbort: .string "Data Abort" Csting_reserved: .string "Reserved" Csting_fiq: .string "FIQ dummy" .size QF_except, . - QF_except .endfunc .end ================================================ FILE: ports/arm7-9/qv/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port ARM7-9, QV-nano kernel, IAR-ARM toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* fast unconditional interrupt disabling/enabling for ARM state, NOTE2 */ #define QF_INT_DISABLE() __asm("MSR cpsr_c,#(0x1F | 0x80)") #define QF_INT_ENABLE() __asm("MSR cpsr_c,#(0x1F)") /* interrupt disabling policy for ISR level for ARM state */ #define QF_ISR_NEST #define QF_ISR_STAT_TYPE unsigned long #define QF_ISR_DISABLE(stat_) do { \ (stat_) = __get_CPSR(); \ QF_INT_DISABLE(); \ } while (false) #define QF_ISR_RESTORE(stat_) __set_CPSR(stat_) /* QV-nano initialization and ISR entry/exit */ void QV_irq(void); void BSP_irq(void); /* void BSP_fiq(void); see NOTE1 */ #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ void QF_reset(void); void QF_undef(void); void QF_swi(void); void QF_pAbort(void); void QF_dAbort(void); void QF_reserved(void); void QF_unused(void); /***************************************************************************** * NOTE1: * The disabling/enabling of interrutps is only defined for the ARM state, * which means that any code that disables/enables interrutps must be compiled * to ARM. The policy is to disable only the IRQ and NOT to disable the FIQ, * which means that FIQ is a "QF-unaware" from the kernel perspective. This means * that FIQ has "zero latency", but it also means that FIQ *cannot* call any * QP services. Specifically FIQ cannot post or publish events. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/arm7-9/qv/iar/qvn_port.s ================================================ ;----------------------------------------------------------------------------- ; Product: QV port to ARM7-9, IAR-ARM Assembler ; Last Updated for Version: 5.4.0 ; Date of the Last Update: 2015-04-01 ; ; Q u a n t u m L e a P s ; --------------------------- ; innovating embedded systems ; ; Copyright (C) Quantum Leaps, LLC. All rights reserved. ; ; This program is open source software: you can redistribute it and/or ; modify it under the terms of the GNU General Public License as published ; by the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; Alternatively, this program may be distributed and modified under the ; terms of Quantum Leaps commercial licenses, which expressly supersede ; the GNU General Public License and are specifically designed for ; licensees interested in retaining the proprietary status of their code. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program. If not, see . ; ; Contact information: ; Web: http://www.state-machine.com ; Email: info@state-machine.com ;----------------------------------------------------------------------------- NO_IRQ DEFINE 0x80 ; mask to disable interrupts (FIQ and IRQ) NO_FIQ DEFINE 0x40 ; mask to disable interrupts (FIQ and IRQ) FIQ_MODE DEFINE 0x11 IRQ_MODE DEFINE 0x12 SYS_MODE DEFINE 0x1F ;----------------------------------------------------------------------------- ; Interrupt disabling/enabling and QK initialization ;----------------------------------------------------------------------------- SECTION .textrw:DATA:NOROOT(2) PUBLIC QF_int_disable_SYS, QF_int_enable_SYS CODE32 QF_int_disable_SYS: MRS r0,cpsr ; get the original CPSR in r0 to return MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; disable IRQ only, FIQ enabled! BX lr ; return the original CPSR in r0 QF_int_enable_SYS: MSR cpsr_c,r0 ; restore the original CPSR from r0 BX lr ; return to ARM or THUMB ;----------------------------------------------------------------------------- ; IRQ assembly wrapper ;----------------------------------------------------------------------------- SECTION .textrw:DATA:NOROOT(2) PUBLIC QV_irq EXTERN BSP_irq CODE32 QV_irq: ; IRQ entry {{{ MOV r13,r0 ; save r0 in r13_IRQ SUB r0,lr,#4 ; put return address in r0_SYS MOV lr,r1 ; save r1 in r14_IRQ (lr) MRS r1,spsr ; put the SPSR in r1_SYS MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; SYSTEM, no IRQ, but FIQ enabled! STMFD sp!,{r0,r1} ; save SPSR and PC on SYS stack STMFD sp!,{r2-r3,r12,lr} ; save APCS-clobbered regs on SYS stack MOV r0,sp ; make the sp_SYS visible to IRQ mode SUB sp,sp,#(2*4) ; make room for stacking (r0_SYS, r1_SYS) MSR cpsr_c,#(IRQ_MODE | NO_IRQ) ; IRQ mode, IRQ disabled STMFD r0!,{r13,r14} ; finish saving the context (r0_SYS,r1_SYS) MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; SYSTEM mode, IRQ disabled ; IRQ entry }}} ; NOTE: BSP_irq might re-enable IRQ interrupts (the FIQ is enabled ; already), if IRQs are prioritized by the interrupt controller. ; LDR r12,=BSP_irq MOV lr,pc ; copy the return address to link register BX r12 ; call the C IRQ-handler (ARM/THUMB) ; IRQ exit {{{ MSR cpsr_c,#(SYS_MODE | NO_IRQ) ; make sure IRQs are disabled MOV r0,sp ; make sp_SYS visible to IRQ mode ADD sp,sp,#(8*4) ; fake unstacking 8 registers from sp_SYS MSR cpsr_c,#(IRQ_MODE | NO_IRQ) ; IRQ mode, IRQ disabled MOV sp,r0 ; copy sp_SYS to sp_IRQ LDR r0,[sp,#(7*4)] ; load the saved SPSR from the stack MSR spsr_cxsf,r0 ; copy it into spsr_IRQ LDMFD sp,{r0-r3,r12,lr}^ ; unstack all saved USER/SYSTEM registers NOP ; can't access banked reg immediately LDR lr,[sp,#(6*4)] ; load return address from the SYS stack MOVS pc,lr ; return restoring CPSR from SPSR ; IRQ exit }}} ;----------------------------------------------------------------------------- ; Exception assembler wrappers ;----------------------------------------------------------------------------- PUBLIC QF_reset PUBLIC QF_undef PUBLIC QF_swi PUBLIC QF_pAbort PUBLIC QF_dAbort PUBLIC QF_reserved EXTERN Q_onAssert SECTION .text:CODE:NOROOT(2) CODE32 QF_reset: LDR r0,=Csting_reset B QF_except QF_undef: LDR r0,=Csting_undef B QF_except QF_swi: LDR r0,=Csting_swi B QF_except QF_pAbort: LDR r0,=Csting_pAbort B QF_except QF_dAbort: LDR r0,=Csting_dAbort B QF_except QF_reserved: LDR r0,=Csting_reserved B QF_except QF_except: ; r0 is set to the string with the exception name SUB r1,lr,#4 ; set line number to the exception address MSR cpsr_c,#(SYS_MODE | NO_IRQ | NO_FIQ) ; SYSTEM, IRQ/FIQ disabled LDR r12,=Q_onAssert MOV lr,pc ; store the return address BX r12 ; call the assertion-handler (ARM/THUMB) ; the assertion handler should not return, but in case it does ; hang up the machine in this endless loop B . LTORG ; strings enclosed in "" are zero-terminated Csting_reset: DC8 "Reset" Csting_undef: DC8 "Undefined" Csting_swi: DC8 "Software Int" Csting_pAbort: DC8 "Prefetch Abort" Csting_dAbort: DC8 "Data Abort" Csting_reserved: DC8 "Reserved" END ================================================ FILE: ports/avr/README.txt ================================================ About The QP-AVR Port ===================== This directory contains the QP-nano ports to the 8-bit AVRmega processor family. The following ports are provided: avr | +-qk - port to the preemptive QK kernel | +-gnu - port with the GNU-AVR toolset | +-iar - port with the IAR-AVR toolset | +-qv - port to the cooperative QV kernel | +-gnu - port with the GNU-AVR toolset | +-iar - port with the IAR-AVR toolset Please see the README.txt files in the sub-directories for more information about building the QP libraries. ================================================ FILE: ports/avr/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/avr.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/avr/qk/gnu/README.txt ================================================ About The QP-AVR Port ===================== This directory contains the QP-nano port to the 8-bit AVRmega processor family with the GNU-AVR compiler. This port can be built with the standalone WinAVR toolset (see http://sourceforge.net/projects/winavr/files/WinAVR/), or with the GNU-AVR toolset that ships with the Atmel Studio. ================================================ FILE: ports/avr/qk/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port AVR ATmega, preemptive QK-nano kernel, GNU-AVR toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* GNU-AVR function attribute for "no-return" function */ #define Q_NORETURN __attribute__ ((noreturn)) void /* GNU-AVR extended keyword '__flash' allocates const objects to ROM */ #define Q_ROM __flash /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __asm__ __volatile__ ("cli" ::) #define QF_INT_ENABLE() __asm__ __volatile__ ("sei" ::) /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QK-nano interrupt entry/exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } while (false) /* QK sleep mode */ #define QK_CPU_SLEEP() do { \ __asm__ __volatile__ ("sleep" ::); \ SMCR = 0U; \ } while (false) /* QF CPU reset for AVR */ #define QF_RESET() __asm__ __volatile__ ("jmp 0x0000" ::) #include /* accessing data in program memory (PROGMEM) */ #include /* AVR interrupt support */ #include /* SREG/SMCR definitions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/avr/qk/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port AVR ATmega, QK-nano kernel, IAR-AVR toolset * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! IAR extended keyword __noreturn designates a "no-return" function */ #define Q_NORETURN __noreturn void /* IAR extended keyword '__flash' allocates const objects to ROM */ #define Q_ROM __flash /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QK-nano interrupt entry/exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } while (false) /* QK sleep mode... */ #define QK_CPU_SLEEP() do { \ __sleep(); \ SMCR = 0U; \ } while (false) /* QF CPU reset for AVR */ #define QF_RESET() __asm("jmp 0x0000") #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/avr/qv/gnu/README.txt ================================================ About The QP-AVR Port ===================== This directory contains the QP-nano port to the 8-bit AVRmega processor family with the GNU-AVR compiler. This port can be built with the standalone WinAVR toolset (see http://sourceforge.net/projects/winavr/files/WinAVR/), or with the GNU-AVR toolset that ships with the Atmel Studio. ================================================ FILE: ports/avr/qv/gnu/qfn_port.h ================================================ /** * @file * @brief QF-nano port AVR ATmega, cooperative QV-nano kernel, GNU-AVR toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-22 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* GNU-AVR function attribute for "no-return" function */ #define Q_NORETURN __attribute__ ((noreturn)) void /* GNU-AVR extended keyword '__flash' allocates const objects to ROM */ #define Q_ROM __flash /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __asm__ __volatile__ ("cli" ::) #define QF_INT_ENABLE() __asm__ __volatile__ ("sei" ::) /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QV sleep mode, see NOTE1... */ #define QV_CPU_SLEEP() do { \ __asm__ __volatile__ ("sei" ::); \ __asm__ __volatile__ ("sleep" ::); \ SMCR = 0U; \ } while (false) /* QF CPU reset for AVR */ #define QF_RESET() __asm__ __volatile__ ("jmp 0x0000" ::) #include /* accessing data in program memory (PROGMEM) */ #include /* AVR interrupt support */ #include /* SREG/SMCR definitions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * As described in the "AVR Datasheet" in Section "Reset and Interrupt * Handling", when using the SEI instruction to enable interrupts, the * instruction following SEI will be executed before any pending interrupts. * As the Datasheet shows in the assembly example, the pair of instructions * SEI ; enable interrupts * SLEEP ; go to the sleep mode * executes ATOMICALLY, and so no interrupt can be serviced between these * instructins. You should NEVER separate these two lines. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/avr/qv/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port AVR ATmega, cooperative QV-nano kernel, IAR-AVR toolset * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /*! IAR extended keyword __noreturn designates a "no-return" function */ #define Q_NORETURN __noreturn void /* IAR extended keyword '__flash' allocates const objects to ROM */ #define Q_ROM __flash /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QV sleep mode, see NOTE1... */ #define QV_CPU_SLEEP() do { \ __enable_interrupt(); \ __sleep(); \ SMCR = 0U; \ } while (false) /* QF CPU reset for AVR */ #define QF_RESET() __asm("jmp 0x0000") #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ /***************************************************************************** * NOTE1: * As described in the "AVR Datasheet" in Section "Reset and Interrupt * Handling", when using the SEI instruction to enable interrupts, the * instruction following SEI will be executed before any pending interrupts. * As the Datasheet shows in the assembly example, the pair of instructions * SEI ; __enable_interrupt() intrinsic function * SLEEP ; __sleep() intrinsic function * executes ATOMICALLY, and so no interrupt can be serviced between these * instructins. You should NEVER separate these two lines. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/lint-plus/16bit/cpu.lnt ================================================ // Size Options for 16bit CPU (e.g., MSP430) -si2 -sl4 -sll8 -ss2 -sw2 -sf4 -sd4 -sld4 -ai2 -al2 -all2 -as2 -af2 -ad2 -ald2 ================================================ FILE: ports/lint-plus/16bit/stdint.h ================================================ /** * @file * @brief Selected exact-width and fast minimum-width integer types * for 16-bit CPU architecture (e.g., MSP430). * * @description * This header is part of the ANSI C99 standard library to define the * standard exact-width integer types (see C99 Section 7.18.1.1). * If the compiler does not provide the stdint.h header file, you can * either create one in the QP port directory, or you can typedef the * 8 exact-width integer types directly in the qep_port.h header file. * * @note The version included in the QP documentation contains only the 8 * exact-width types and 6 fast minimum-width types actually used in QP. * The actual definition of the integer types is platform dependent. */ #ifndef STDINT_H #define STDINT_H /*lint -save */ /*lint -e9093 M3:R21.2(r) name matches a pattern reserved to the compiler */ /* Exact-width types. WG14/N843 C99 Standard, Section 7.18.1.1 */ typedef signed char int8_t; /*!< exact-width 8-bit signed int */ typedef signed int int16_t; /*!< exact-width 16-bit signed int */ typedef signed long int int32_t; /*!< exact-width 32-bit signed int */ typedef signed long long int64_t; /*!< exact-width 64-bit signed int */ typedef unsigned char uint8_t; /*!< exact-width 8-bit unsigned int */ typedef unsigned int uint16_t; /*!< exact-width 16-bit unsigned int */ typedef unsigned long int uint32_t; /*!< exact-width 32-bit unsigned int */ typedef unsigned long long uint64_t; /*!< exact-width 64-bit unsigned int */ /* Fastest minimum-width types. WG14/N843 C99 Standard, Section 7.18.1.3 */ typedef signed int int_fast8_t; /*!< fast at-least 8-bit signed int */ typedef unsigned int uint_fast8_t; /*!< fast at-least 8-bit unsigned int */ typedef signed int int_fast16_t; /*!< fast at-least 16-bit signed int */ typedef unsigned int uint_fast16_t; /*!< fast at-least 16-bit unsigned int */ typedef signed long int_fast32_t; /*!< fast at-least 32-bit signed int */ typedef unsigned long uint_fast32_t; /*!< fast at-least 32-bit unsigned int */ /*lint -restore */ #endif /* STDINT_H */ ================================================ FILE: ports/lint-plus/32bit/cpu.lnt ================================================ // Size Options for 32bit CPU (e.g., ARM Cortex-M) -si4 -sl4 -sll8 -ss2 -sw4 -sp4 -sf4 -sd8 -sld8 +fzl ================================================ FILE: ports/lint-plus/32bit/stdint.h ================================================ /** * @file * @brief Selected exact-width and fast minimum-width integer types * for 32-bit CPU architecture (e.g., ARM Cortex-M). * * @description * This header is part of the ANSI C99 standard library to define the * standard exact-width integer types (see C99 Section 7.18.1.1). * If the compiler does not provide the stdint.h header file, you can * either create one in the QP port directory, or you can typedef the * 8 exact-width integer types directly in the qep_port.h header file. * * @note The version included in the QP documentation contains only the 8 * exact-width types and 6 fast minimum-width types actually used in QP. * The actual definition of the integer types is platform dependent. */ #ifndef STDINT_H #define STDINT_H /*lint -save */ /*lint -e9093 M3:R21.2(r) name matches a pattern reserved to the compiler */ /* Exact-width types. WG14/N843 C99 Standard, Section 7.18.1.1 */ typedef signed char int8_t; /*!< exact-width 8-bit signed int */ typedef signed short int16_t; /*!< exact-width 16-bit signed int */ typedef signed long int32_t; /*!< exact-width 32-bit signed int */ typedef signed long long int64_t; /*!< exact-width 64-bit signed int */ typedef unsigned char uint8_t; /*!< exact-width 8-bit unsigned int */ typedef unsigned short uint16_t; /*!< exact-width 16-bit unsigned int */ typedef unsigned long uint32_t; /*!< exact-width 32-bit unsigned int */ typedef unsigned long long uint64_t; /*!< exact-width 64-bit unsigned int */ /* Fastest minimum-width types. WG14/N843 C99 Standard, Section 7.18.1.3 */ typedef signed int int_fast8_t; /*!< fast at-least 8-bit signed int */ typedef unsigned int uint_fast8_t; /*!< fast at-least 8-bit unsigned int */ typedef signed int int_fast16_t; /*!< fast at-least 16-bit signed int */ typedef unsigned int uint_fast16_t; /*!< fast at-least 16-bit unsigned int */ typedef signed long int_fast32_t; /*!< fast at-least 32-bit signed int */ typedef unsigned long uint_fast32_t; /*!< fast at-least 32-bit unsigned int */ /*lint -restore */ #endif /* STDINT_H */ ================================================ FILE: ports/lint-plus/au-ds.lnt ================================================ // au-ds.lnt -- Author options - Dan Saks /* This options file can be used to explicitly activate those checks advocated by Dan Saks in his series of presentations on "C++ Gotchas". You can use this file directly when linting your programs as in: lin au-ds files */ +fsc // consider string constants as const char * +e1933 // turn on "virtual call from member detection" // The rationale for the following two options are fully described // in Dan Saks' article "const T vs. T const". Visit his web site // at www.dansaks.com and click "Published Articles". // -fqb +e963 // require T const rather than const T ================================================ FILE: ports/lint-plus/au-misra3-amd1.lnt ================================================ // --------------------------------------------------------------------------- // Copyright Gimpel Software LLC 2019. All rights reserved. // // This file is provided by Gimpel Software LLC (https://www.gimpel.com) for // use with PC-lint Plus. Redistribution is permitted but any redistribution // must preserve this notice and, if the redistributed file has been modified, // provide notice that the file has been modified from the original. // --------------------------------------------------------------------------- // au-misra3-amd1.lnt -- Author options - MISRA C 2012 /* This options file can be used to explicitly activate those checks advocated by the Motor Industry Software Reliability Association. You can use this file directly when linting your programs as in: lint au-misra3-amd1.lnt hello.c Gimpel Software relies on the document, "MISRA C:2012 Amendment 1 Additional security guidelines for MISRA C:2012" copyright 2016 by HORIBA MIRA Ltd, as the primary source for this file. Gimpel Software makes no warranty as to the completeness or applicability of this options file and reserves the right to amend or alter the official contents of such at any time. "MISRA" is a registered trademark of HORIBA MIRA Ltd, held on behalf of the MISRA Consortium. */ /* version check */ -cond('%PCLP_NO_LNT_VERSION_CHECK%' != '1' && (%LINT_MAJOR_VERSION% != 1 || %LINT_MINOR_VERSION% != 3), +fatal_error(This configuration file is intended for PC-lint Plus 1.3. You are attempting to use it with PC-lint Plus %LINT_MAJOR_VERSION%.%LINT_MINOR_VERSION%. It is recommended that you use configuration files intended for PC-lint Plus %LINT_MAJOR_VERSION%.%LINT_MINOR_VERSION%.) ) /**** Dir 4.14 (Req) ************/ /* Not currently supported */ /**** Rule 12.5 (Mand) ************/ +e682 /* sizeof applied to parameter whose type is sized array */ +elib(682) -append(682,[MISRA 2012 Rule 12.5, mandatory]) +e882 /* sizeof applied to parameter declared as incomplete array */ +elib(882) -append(882,[MISRA 2012 Rule 12.5, mandatory]) /**** Rule 21.13 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ /* Define EOF until a proper definition is seen */ -dEOF=-1 /* Define UCHAR_MIN and UCHAR_MAX if no definition available */ -dUCHAR_MIN=0 -dUCHAR_MAX=255 /* Ensure macro versions of ctype.h functions expand to function versions to make use of the function semantics defined below */ --uisalnum --uisalpha --uisblank --uiscntrl --uisdigit --uisgraph --uislower --uisprint --uispunct --uisspace --uisupper --uisxdigit --utolower --utoupper /* Define semantics for ctype.h functions */ -sem(isalnum, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isalpha, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isblank, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(iscntrl, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isdigit, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isgraph, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(islower, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isprint, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(ispunct, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isspace, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isupper, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(isxdigit, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(tolower, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) -sem(toupper, (1n >= UCHAR_MIN && 1n <= UCHAR_MAX) || 1n == EOF) +esym(426, isalnum) +esym(426, isalpha) +esym(426, isblank) +esym(426, iscntrl) +esym(426, isdigit) +esym(426, isgraph) +esym(426, islower) +esym(426, isprint) +esym(426, ispunct) +esym(426, isspace) +esym(426, isupper) +esym(426, isxdigit) +esym(426, tolower) +esym(426, toupper) -append(426(isalnum), value passed to isalnum is not representable as unsigned char and is not EOF) -append(426(isalnum),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isalpha), value passed to isalpha is not representable as unsigned char and is not EOF) -append(426(isalpha),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isblank), value passed to isblank is not representable as unsigned char and is not EOF) -append(426(isblank),[MISRA 2012 Rule 21.13, mandatory]) -append(426(iscntrl), value passed to iscntrl is not representable as unsigned char and is not EOF) -append(426(iscntrl),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isdigit), value passed to isdigit is not representable as unsigned char and is not EOF) -append(426(isdigit),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isgraph), value passed to isgraph is not representable as unsigned char and is not EOF) -append(426(isgraph),[MISRA 2012 Rule 21.13, mandatory]) -append(426(islower), value passed to islower is not representable as unsigned char and is not EOF) -append(426(islower),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isprint), value passed to isprint is not representable as unsigned char and is not EOF) -append(426(isprint),[MISRA 2012 Rule 21.13, mandatory]) -append(426(ispunct), value passed to ispunct is not representable as unsigned char and is not EOF) -append(426(ispunct),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isspace), value passed to isspace is not representable as unsigned char and is not EOF) -append(426(isspace),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isupper), value passed to isupper is not representable as unsigned char and is not EOF) -append(426(isupper),[MISRA 2012 Rule 21.13, mandatory]) -append(426(isxdigit), value passed to isxdigit is not representable as unsigned char and is not EOF) -append(426(isxdigit),[MISRA 2012 Rule 21.13, mandatory]) -append(426(tolower), value passed to tolower is not representable as unsigned char and is not EOF) -append(426(tolower),[MISRA 2012 Rule 21.13, mandatory]) -append(426(toupper), value passed to toupper is not representable as unsigned char and is not EOF) -append(426(toupper),[MISRA 2012 Rule 21.13, mandatory]) /**** Rule 21.14 (Req) ************/ /* Not currently supported */ /**** Rule 21.15 (Req) ************/ +e857 /* incompatible pointer arguments to memcpy/memmove/memcmp */ +elib(857) -append(857,[MISRA 2012 Rule 21.15, required]) /**** Rule 21.16 (Req) ************/ +e9098 /* pointer argument to memcmp does not point to a pointer type or an essentially signed, unsigned, boolean, or enum type */ +elib(9098) -append(9098,[MISRA 2012 Rule 21.16, required]) /**** Rule 21.17 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ /* 419 - apparent data overrun for function */ /* 420 - apparent access beyond array for function */ +esym(419 420, strcat, strcpy) -append(419(strcat),[MISRA 2012 Rule 21.17, mandatory]) -append(420(strcat),[MISRA 2012 Rule 21.17, mandatory]) -append(419(strcpy),[MISRA 2012 Rule 21.17, mandatory]) -append(420(strcpy),[MISRA 2012 Rule 21.17, mandatory]) /**** Rule 21.18 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ /* 419 - apparent data overrun for function */ /* 420 - apparent access beyond array for function */ /* 422 - function passed a negative value */ +esym(419 420 422, memchr, memcmp, memcpy, memmove, memset) +esym(419 420 422, strncat, strncmp, strncpy, strxfrm) /* PC-lint Plus will issue 419 when it can determine that * the size parameter of the below functions exceeds the * size of the buffer that is being written to. */ -append(419(memcpy),[MISRA 2012 Rule 21.18, mandatory]) -append(419(memmove),[MISRA 2012 Rule 21.18, mandatory]) -append(419(strncat),[MISRA 2012 Rule 21.18, mandatory]) -append(419(strncpy),[MISRA 2012 Rule 21.18, mandatory]) /* PC-lint Plus will issue 420 when it can determine that * the size parameter of the below functions exceeds the * size of the buffer that is being read from. */ -append(420(memchr),[MISRA 2012 Rule 21.18, mandatory]) -append(420(memcmp),[MISRA 2012 Rule 21.18, mandatory]) -append(420(memcpy),[MISRA 2012 Rule 21.18, mandatory]) -append(420(memmove),[MISRA 2012 Rule 21.18, mandatory]) /* PC-lint Plus will issue 422 when it can determine that * a negative value is being passed to the size parameter * of the below functions. */ -append(422(memchr),[MISRA 2012 Rule 21.18, mandatory]) -append(422(memcmp),[MISRA 2012 Rule 21.18, mandatory]) -append(422(memcpy),[MISRA 2012 Rule 21.18, mandatory]) -append(422(memmove),[MISRA 2012 Rule 21.18, mandatory]) -append(422(memset),[MISRA 2012 Rule 21.18, mandatory]) -append(422(strncat),[MISRA 2012 Rule 21.18, mandatory]) -append(422(strncmp),[MISRA 2012 Rule 21.18, mandatory]) -append(422(strncpy),[MISRA 2012 Rule 21.18, mandatory]) -append(422(strxfrm),[MISRA 2012 Rule 21.18, mandatory]) /**** Rule 21.19 (Mand) ************/ /* Not currently supported */ /**** Rule 21.20 (Mand) ************/ /* Not currently supported */ /**** Rule 22.7 (Req) ************/ /* Not currently supported */ /**** Rule 22.8 (Req) ************/ /* Not currently supported */ /**** Rule 22.9 (Req) ************/ /* Not currently supported */ /**** Rule 22.10 (Req) ************/ /* Not currently supported */ ================================================ FILE: ports/lint-plus/au-misra3.lnt ================================================ // --------------------------------------------------------------------------- // Copyright Gimpel Software LLC 2019. All rights reserved. // // This file is provided by Gimpel Software LLC (https://www.gimpel.com) for // use with PC-lint Plus. Redistribution is permitted but any redistribution // must preserve this notice and, if the redistributed file has been modified, // provide notice that the file has been modified from the original. // --------------------------------------------------------------------------- // au-misra3.lnt -- Author options - MISRA C 2012 /* This options file can be used to explicitly activate those checks advocated by the Motor Industry Software Reliability Association. You can use this file directly when linting your programs as in: lint au-misra3.lnt hello.c Gimpel Software relies on the document, "MISRA-C:2012 Guidelines for the use of the C language in critical systems", copyright 2012 by MISRA Limited, as the primary source for this file. Gimpel Software makes no warranty as to the completeness or applicability of this options file and reserves the right to amend or alter the official contents of such at any time. "MISRA" is a registered trademark of MIRA Limited, held on behalf of the MISRA Consortium. */ /* version check */ -cond('%PCLP_NO_LNT_VERSION_CHECK%' != '1' && (%LINT_MAJOR_VERSION% != 1 || %LINT_MINOR_VERSION% != 3), +fatal_error(This configuration file is intended for PC-lint Plus 1.3. You are attempting to use it with PC-lint Plus %LINT_MAJOR_VERSION%.%LINT_MINOR_VERSION%. It is recommended that you use configuration files intended for PC-lint Plus %LINT_MAJOR_VERSION%.%LINT_MINOR_VERSION%.) ) /**** Dir 1.1 (Req) ************/ /* not statically checkable */ /**** Dir 2.1 (Req) ************/ -std(c99) /* strict ISO C99 */ /* Note: if you code to the C90 standard instead, you may want to comment out the above option and uncomment the following option. You will also want to do likewise for other uses of the '-std(c99)' option throughout this file. */ // -std(c90) /**** Dir 3.1 (Req) ************/ /* not statically checkable */ /**** Dir 4.1 (Req) ************/ /* not statically checkable */ /**** Dir 4.2 (Adv) ************/ /* not statically checkable */ /**** Dir 4.3 (Req) ************/ +e586 /* to activate the deprecation message */ +elib(586) -deprecate(keyword,asm,[MISRA 2012 Directive 4.3, required]) /**** Dir 4.4 (Adv) ************/ /* This requirement (that there be no commented-out code) is, in principle, not statically checkable. The reason given for the requirement is that comments do not nest. Thus a commented out section of code that happens to use slash-star commenting could inadvertently introduce unwanted code. Rule 3.1, however, addresses the nested comment issue and hence the major concern that this requirement seeks to address is indeed checkable. */ -fnc /* flag nested comments */ +e602 /* comment within comment */ +elib(602) -append(602,[MISRA 2012 Directive 4.4, advisory]) /**** Dir 4.5 (Adv) ************/ +fta /* enable typographical ambiguity checking */ +e9046 /* typographical ambiguity */ +elib(9046) -append(9046,[MISRA 2012 Directive 4.5, advisory]) /**** Dir 4.6 (Adv) ************/ +e970 /* flag modifiers used outside of typedefs */ +elib(970) -append(970,[MISRA 2012 Directive 4.6, advisory]) // For the duration, we are presuming MISRA does not want // diagnostics for the bool type. -esym(970,bool) -esym(970,char) /**** Dir 4.7 (Req) ************/ +e534 /* ignoring return value of function */ +elib(534) -append(534,[MISRA 2012 Directive 4.7, required]) /**** Dir 4.8 (Adv) ************/ +e9045 /* non-hidden definition of type */ +elib(9045) -append(9045,[MISRA 2012 Directive 4.8, advisory]) /**** Dir 4.9 (Adv) ************/ +e9026 /* function-like macro defined */ +elib(9026) -append(9026,[MISRA 2012 Directive 4.9, advisory]) /**** Dir 4.10 (Req) ************/ +e451 /* Header repeatedly included without guard */ +elib(451) -append(451,[MISRA 2012 Directive 4.10, required]) /**** Dir 4.11 (Req) ************/ /* The arguments to over 100 calls to standard library functions are monitored; users can specify additional constraints for other functions. */ /**** Dir 4.12 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,calloc,[MISRA 2012 Directive 4.12, required]) -deprecate(function,malloc,[MISRA 2012 Directive 4.12, required]) -deprecate(function,realloc,[MISRA 2012 Directive 4.12, required]) -deprecate(function,free,[MISRA 2012 Directive 4.12, required]) /**** Dir 4.13 (Adv) ************/ /* Not currently supported */ /**** Rule 1.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ -std(c99) /* strict ISO C99 */ /* Note: if you code to the C90 standard instead, you may want to comment out the above option and uncomment the following option. You will also want to do likewise for other uses of the '-std(c99)' option throughout this file. */ // -std(c90) /**** Rule 1.2 (Adv) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ -std(c99) /* strict ISO C99 */ /* Note: if you code to the C90 standard instead, you may want to comment out the above option and uncomment the following option. You will also want to do likewise for other uses of the '-std(c99)' option throughout this file. */ // -std(c90) /**** Rule 1.3 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ /* Avoid the use of undefined or unspecified behavior as described in ISO C, Appendix A.6.1 and Appendix A.6.2 */ /* Source file not ending in a new-line character, ending in new-line character immediately preceded by a backslash character, or ending in a partial preprocessing token or comment (ISO C, Appendix A.6.2, point 1). */ /* Unclosed quotes (ISO C, Appendix A.6.2, point 4). */ +e2 /* unclosed quote */ +elib(2) -append(2,[MISRA 2012 Rule 1.3, required]) /* Repeated label within a function (ISO C, Appendix A.6.2, point 5). */ +e31 /* symbol redefinition */ +elib(31) -append(31,[MISRA 2012 Rule 1.3, required]) /* Non-visible identifier used (ISO C, Appendix A.6.2, point 6). */ +e40 /* undeclared identifier */ +elib(40) -append(40,[MISRA 2012 Rule 1.3, required]) /* Identifiers for the same entity differ beyond the minimal significant characters (ISO C, Appendix A.6.2, point 7). See Rules 5.1, 5.2, 5.4, and 5.5. */ /* The same identifier has both internal and external linkage in the same translation unit (ISO C, Appendix A.6.2, point 8). */ +e401 /* symbol not previously declared static */ +elib(401) -append(401,[MISRA 2012 Rule 1.3, required]) /* Multiple definitions for the same externally linked identifier (ISO C, Appendix A.6.2, point 9). */ +e31 /* symbol redefinition */ +elib(31) /* Using automatic storage data via a pointer after the data's lifetime (ISO C, Appendix A.6.2, point 10). */ +e604 /* returning address of auto variable */ +elib(604) -append(604,[MISRA 2012 Rule 1.3, required]) /* Incompatible redeclarations (ISO C, Appendix A.6.2, point 11). See Rule 8.3 */ /* Non-standard escape sequence (ISO C, Appendix A.6.2, point 12). */ +e606 /* non-ANSI escape sequence */ +elib(606) -append(606,[MISRA 2012 Rule 1.3, required]) /* Non-standard character in header name (ISO C, Appendix A.6.2, point 15). See Rule 20.2 */ +e9020 /* header name with non-standard character */ +elib(9020) -append(9020,[MISRA 2012 Rule 1.3, required]) /* No complete type available (ISO C, Appendix A.6.2, point 16). */ +e86 /* structure has no data elements */ +elib(86) -append(86,[MISRA 2012 Rule 1.3, required]) /* Modifying an object more than once or modifying and accessing between two sequence points (ISO C, Appendix A.6.2, point 18). See Rule 13.2 */ +e564 /* variable depends on order of evaluation */ +elib(564) -append(564,[MISRA 2012 Rule 1.3, required]) /* Invalid arithmetic operations or unrepresentable results (ISO C, Appendix A.6.2, point 19). */ +e54 /* division by 0 */ +elib(54) -append(54,[MISRA 2012 Rule 1.3, required]) +e414 /* possible division by 0 */ +elib(414) -append(414,[MISRA 2012 Rule 1.3, required]) /* Also, see Rule 12.4 */ /* Passing a void argument to a function (ISO C, Appendix A.6.2, point 20). */ /* Incompatible function redeclaration (ISO C, Appendix A.6.2, point 22). See Rule 8.3 */ /* An invalid array reference, null pointer reference, or reference to an object declared with automatic storage duration in a terminated block occurs (ISO C, Appendix A.6.2, point 24). */ +e413 /* likely use of null pointer */ +elib(413) -append(413,[MISRA 2012 Rule 1.3, required]) +e415 /* out-of-bounds pointer */ +elib(415) -append(415,[MISRA 2012 Rule 1.3, required]) +e416 /* out-of-bounds pointer */ +elib(416) -append(416,[MISRA 2012 Rule 1.3, required]) +e428 /* negative subscript */ +elib(428) -append(428,[MISRA 2012 Rule 1.3, required]) /* Also, see Rule 17.6 */ /* A pointer to a function is converted to a pointer to an object or a pointer to an object is converted to a pointer to a function (ISO C, Appendix A.6.2, point 26). */ +e2454 /* incompatible pointer types */ +elib(2454) -append(2454,[MISRA 2012 Rule 1.3, required]) /* An identifier for an object is declared with no linkage and the type of the object is incomplete after its declarator, or after its init-declarator if it has an initializer (ISO C, Appendix A.6.2, point 33). */ +e86 /* structure has no data elements */ +elib(86) /* Declaring a function at block scope with a storage-class specifier other than extern (ISO C, Appendix A.6.2, point 34). */ +e629 /* static class for function */ +elib(629) -append(629,[MISRA 2012 Rule 1.3, required]) /* A bit-field is declared with a type other than int, signed int, or unsigned int (ISO C, Appendix A.6.2, point 35). See Rule 6.1. */ /* Using the value of uninitialized automatic object (ISO C, Appendix A.6.2, point 38). See Rule 9.1 */ /* An object with aggregate or union type with static storage duration has a non-brace-enclosed initializer, or an object with aggregate or union type with automatic storage duration has either a single expression initializer with a type other than that of the object or a non-brace-enclosed initializer (ISO C, Appendix A.6.2, point 39). Also, see Rule 9.2 */ +e64 /* type mismatch */ +elib(64) -append(64,[MISRA 2012 Rule 1.3, required]) /* The value of a function is used, but no value was returned (ISO C, Appendix A.6.2, point 40). See Rule 17.4. */ /* A function that accepts a variable number of arguments is defined without a parameter type list that ends with the ellipsis notation (ISO C, Appendix A.6.2, point 41). */ /* An identifier for an object with internal linkage and an incomplete type is declared with a tentative definition (ISO C, Appendix A.6.2, point 42). */ +e86 /* structure has no data elements */ +elib(86) /* Non-standard #include preprocessing directive (ISO C, Appendix A.6.2, point 44). See Rule 20.3. */ /* Non-standard #line directive (ISO C, Appendix A.6.2, point 49). */ +"estring(10,a numeric constant)" /* expecting a numeric constant */ /* #defining or #undefing any of: defined, __LINE__, __FILE__, __DATE__, __TIME__, or __STDC__ (ISO C, Appendix A.6.2, point 50). */ +e136 /* illegal macro name */ +elib(136) -append(136,[MISRA 2012 Rule 1.3, required]) /* Format-argument mismatch in an fprintf or fscanf type of function (ISO C, Appendix A.6.2, point 75). */ +e558 /* too few arguments */ +elib(558) -append(558,[MISRA 2012 Rule 1.3, required]) +e719 /* too many arguments */ +elib(719) -append(719,[MISRA 2012 Rule 1.3, required]) /* A %% conversion specification for the fprintf or fscanf function contains characters between the pair of % characters (ISO C, Appendix A.6.2, point 77). */ +e557 /* unrecognized format */ +elib(557) -append(557,[MISRA 2012 Rule 1.3, required]) /* An aggregate or union, or a pointer to an aggregate or union is an argument to the fprintf function, except for the conversion specifiers %s (for an array of character type) or %p (for a pointer to void) (ISO C, Appendix A.6.2, point 81). */ +e437 /* passing struct to ellipsis */ +elib(437) -append(437,[MISRA 2012 Rule 1.3, required]) /* Referring to deallocated space (ISO C, Appendix A.6.2, point 87). */ +e449 /* previously deallocated pointer */ +elib(449) -append(449,[MISRA 2012 Rule 1.3, required]) /* Misuse of free or realloc (ISO C, Appendix A.6.2, point 88). */ +esym(424,free) /* inappropriate deallocation */ -append(424,[MISRA 2012 Rule 1.3, required]) /* An array written to by a copying or concatenation function is too small (ISO C, Appendix A.6.2, point 91). */ +e419 /* data overrun */ +elib(419) -append(419,[MISRA 2012 Rule 1.3, required]) /* Order of evaluation (ISO C, Appendix A.6.1, point 7). */ +e564 /* variable depends on order of evaluation */ +elib(564) -append(564,[MISRA 2012 Rule 1.3, required]) /* Side effects order (ISO C, Appendix A.6.1, point 8). */ +e931 /* both sides of an expression have side-effects */ +elib(931) -append(931,[MISRA 2012 Rule 1.3, required]) /* Function argument evaluation (ISO C, Appendix A.6.1, point 9). */ +e564 /* variable depends on order of evaluation */ +elib(564) /* The order in which # and ## operations are evaluated during macro substitution (ISO C, Appendix A.6.1, point 12). */ +e9023 /* multiple '#/##' operators in macro definition */ +elib(9023) -append(9023,[MISRA 2012 Rule 1.3, required]) /* Whether setjmp is a macro or an external identifier (ISO C, Appendix A.6.1, point 14). See Rule 21.2. */ /**** Rule 2.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e527 /* unreachable */ +elib(527) -append(527,[MISRA 2012 Rule 2.1, required]) +e681 /* loop not entered */ +elib(681) -append(681,[MISRA 2012 Rule 2.1, required]) +e827 /* loop not reachable */ +elib(827) -append(827,[MISRA 2012 Rule 2.1, required]) /**** Rule 2.2 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e438 /* value not used */ +elib(438) -append(438,[MISRA 2012 Rule 2.2, required]) +e505 /* redundant argument to comma */ +elib(505) -append(505,[MISRA 2012 Rule 2.2, required]) +e520 /* highest operator has no side effects */ +elib(520) -append(520,[MISRA 2012 Rule 2.2, required]) +e521 /* highest operator has no side effects */ +elib(521) -append(521,[MISRA 2012 Rule 2.2, required]) +e522 /* highest operator has no side effects */ +elib(522) -append(522,[MISRA 2012 Rule 2.2, required]) +e774 /* condition always evaluates to true/false */ +elib(774) -append(774,[MISRA 2012 Rule 2.2, required]) /**** Rule 2.3 (Adv) ************/ +e751 /* local typedef not referenced */ +elib(751) -append(751,[MISRA 2012 Rule 2.3, advisory]) +e756 /* global not referenced */ +elib(756) -append(756,[MISRA 2012 Rule 2.3, advisory]) /**** Rule 2.4 (Adv) ************/ +e753 /* local tag not referenced */ +elib(753) -append(753,[MISRA 2012 Rule 2.4, advisory]) +e9058 +elibsym(9058) -append(9058,[MISRA 2012 Rule 2.4, advisory]) /**** Rule 2.5 (Adv) ************/ +e750 /* local macro not referenced */ +elib(750) -append(750,[MISRA 2012 Rule 2.5, advisory]) +e755 /* global macro not referenced */ +elib(755) -append(755,[MISRA 2012 Rule 2.5, advisory]) /**** Rule 2.6 (Adv) ************/ +e563 /* label not referenced */ +elib(563) -append(563,[MISRA 2012 Rule 2.6, advisory]) /**** Rule 2.7 (Adv) ************/ +e715 /* not referenced */ +elib(715) -append(715,[MISRA 2012 Rule 2.7, advisory]) /**** Rule 3.1 (Req) ************/ -fnc /* flag nested comments */ +e602 /* comment within comment */ +elib(602) -append(602,[MISRA 2012 Rule 3.1, required]) +e9059 +elib(9059) -append(9059,[MISRA 2012 Rule 3.1, required]) +e9066 +elib(9066) -append(9066,[MISRA 2012 Rule 3.1, required]) +e9259 +elib(9259) -append(9259,[MISRA 2012 Rule 3.1, required]) /**** Rule 3.2 (Req) ************/ +e427 /* C++ comment ends in \\ */ +elib(427) -append(427,[MISRA 2012 Rule 3.2, required]) /**** Rule 4.1 (Req) ************/ +e9039 /* prohibited escape sequence */ +elib(9039) -append(9039,[MISRA 2012 Rule 4.1, required]) /**** Rule 4.2 (Adv) ************/ -ftg /* inhibit use of trigraphs */ +e584 /* activate trigraph detected message */ +elib(584) -append(584,[MISRA 2012 Rule 4.2, advisory]) +e739 /* activate trigraph in string message */ +elib(739) -append(739,[MISRA 2012 Rule 4.2, advisory]) +e9060 /* trigraph in comment */ +elib(9060) -append(9060,[MISRA 2012 Rule 4.2, advisory]) /**** Rule 5.1 (Req) ************/ -idlen(31, x) /* Sets the number of significant characters in an external identifier, update as appropriate for your target. Use 'X' instead of 'x' if external identifiers are not case sensitive. C90 guarantees 6 characters are significant, C99 guarantees at least 31 characters are significant. */ +e621 /* identifier clash */ +elib(621) -append(621("external vs external"), [MISRA 2012 Rule 5.1, required]) /**** Rule 5.2 (Req) ************/ -idlen(63, c) /* Sets the number of significant characters in an internal identifier, update as appropriate for your target. Use 'C' instead of 'c' if internal identifiers are not case sensitive. C90 guarantees 31 characters are significant, C99 guarantees at least 63 characters are significant. */ +e621 /* identifier clash */ +elib(621) -append(621("tag vs tag"), [MISRA 2012 Rule 5.2, required]) -append(621("field vs field"), [MISRA 2012 Rule 5.2, required]) -append(621("label vs label"), [MISRA 2012 Rule 5.2, required]) -append(621("internal vs internal, same scope"), [MISRA 2012 Rule 5.2, required]) -append(621("internal vs external, same scope"), [MISRA 2012 Rule 5.2, required]) -append(621("external vs internal, same scope"), [MISRA 2012 Rule 5.2, required]) /**** Rule 5.3 (Req) ************/ +e578 /* enable reports of name hiding */ +elib(578) -append(578,[MISRA 2012 Rule 5.3, required]) /* This rule uses the same -idlen option values as 5.2 */ +e621 /* identifier clash */ +elib(621) -append(621("internal vs internal, enclosing scope"), [MISRA 2012 Rule 5.3, required]) -append(621("internal vs external, enclosing scope"), [MISRA 2012 Rule 5.3, required]) -append(621("external vs internal, enclosing scope"), [MISRA 2012 Rule 5.3, required]) /**** Rule 5.4 (Req) ************/ -idlen(63, p) /* Sets the number of significant characters in a preprocessor identifier, update as appropriate for your target. Use 'P' instead of 'p' if preprocessor identifiers are not case sensitive. C90 guarantees 31 characters are significant, C99 guarantees at least 63 characters are significant. */ +e547 /* conflicting macro definition */ +elib(547) -append(547,[MISRA 2012 Rule 5.4, required]) +e760 /* macro redefined identically */ +elib(760) -append(760,[MISRA 2012 Rule 5.4, required]) +e621 /* identifier clash */ +elib(621) -append(621("macro vs macro"), [MISRA 2012 Rule 5.4, required]) -append(621("macro vs macro parameter"), [MISRA 2012 Rule 5.4, required]) -append(621("macro parameter vs macro parameter"), [MISRA 2012 Rule 5.4, required]) /**** Rule 5.5 (Req) ************/ /* 9095 - symbol has same name as previously defined macro */ +e9095 +elib(9095) -append(9095,[MISRA 2012 Rule 5.5, required]) /* 9096 - symbol has same name as subsequently defined macro */ +e9096 +elib(9096) -append(9096,[MISRA 2012 Rule 5.5, required]) /**** Rule 5.6 (Req) ************/ /* Not currently supported */ /**** Rule 5.7 (Req) ************/ +e407 /* Inconsistent use of tag */ +elib(407) -append(407,[MISRA 2012 Rule 5.7, required]) +e631 /* Tag defined differently */ +elib(631) -append(631,[MISRA 2012 Rule 5.7, required]) /**** Rule 5.8 (Req) ************/ /* Not currently supported */ /**** Rule 5.9 (Adv) ************/ /* Not currently supported */ /**** Rule 6.1 (Req) ************/ /* 9149 bit field must be explicitly signed integer, unsigned integer, or bool */ +e9149 +elib(9149) -append(9149,[MISRA 2012 Rule 6.1, required]) /**** Rule 6.2 (Req) ************/ +e9088 /* named signed single-bit bit-field */ +elib(9088) -append(9088,[MISRA 2012 Rule 6.2, required]) /**** Rule 7.1 (Req) ************/ +e9001 /* Octal constant used */ +elib(9001) -append(9001,[MISRA 2012 Rule 7.1, required]) /**** Rule 7.2 (Req) ************/ +e9048 /* unsigned literal without 'U' suffix */ +elib(9048) -append(9048,[MISRA 2012 Rule 7.2, required]) /**** Rule 7.3 (Req) ************/ +e620 /* suspicious constant */ +elib(620) -append(620,[MISRA 2012 Rule 7.3, required]) +e9057 /* "l" after "u" in literal suffix */ +elib(9057) -append(9057,[MISRA 2012 Rule 7.3, required]) /**** Rule 7.4 (Req) ************/ +fsc +e489 /* attempting to modify a string literal */ +elib(489) -append(489,[MISRA 2012 Rule 7.4, required]) +e1776 /* string literal not const safe */ +elib(1776) -append(1776,[MISRA 2012 Rule 7.4, required]) +e1778 /* assignment of string literal not const safe */ +elib(1778) -append(1778,[MISRA 2012 Rule 7.4, required]) /**** Rule 8.1 (Req) ************/ +e601 /* no explicit type */ +elib(601) -append(601,[MISRA 2012 Rule 8.1, required]) +e808 /* no explicit type */ +elib(808) -append(808,[MISRA 2012 Rule 8.1, required]) +e832 /* parameter has no explicit type */ +elib(832) -append(832,[MISRA 2012 Rule 8.1, required]) /**** Rule 8.2 (Req) ************/ +e937 /* old-style function declaration */ +elib(937) -append(937,[MISRA 2012 Rule 8.2, required]) +e18 /* symbol redeclared */ +elib(18) -append(18,[MISRA 2012 Rule 8.2, required]) +e936 /* old-style function definition */ +elib(936) -append(936,[MISRA 2012 Rule 8.2, required]) +e955 /* param name missing from prototype */ +elib(955) -append(955,[MISRA 2012 Rule 8.2, required]) /**** Rule 8.3 (Req) ************/ +e18 /* symbol redeclared */ +elib(18) -append(18,[MISRA 2012 Rule 8.3, required]) /* 9072 parameter has different name than previous declaration */ +e9072 +elib(9072) -append(9072,[MISRA 2012 Rule 8.3, required]) /* 9073 parameter has type alias name type difference with previous declaration */ +e9073 +elib(9073) -append(9073,[MISRA 2012 Rule 8.3, required]) /* 9094 return type has type alias name difference with previous declaration */ +e9094 +elib(9094) -append(9094,[MISRA 2012 Rule 8.3, required]) /**** Rule 8.4 (Req) ************/ +e15 /* symbol redeclared */ +elib(15) -append(15,[MISRA 2012 Rule 8.4, required]) /* 957 - function defined without prototype in scope */ +e957 +elib(957) -append(957,[MISRA 2012 Rule 8.4, required]) /* 9075 external symbol defined without a prior declaration */ +e9075 +elib(9075) -append(9075,[MISRA 2012 Rule 8.4, required]) /**** Rule 8.5 (Req) ************/ +e9004 /* object/function previously declared */ +elib(9004) -append(9004,[MISRA 2012 Rule 8.5, required]) /**** Rule 8.6 (Req) ************/ /* Not currently supported */ /**** Rule 8.7 (Adv) ************/ +e765 /* could be made static */ +elib(765) -append(765,[MISRA 2012 Rule 8.7, advisory]) /**** Rule 8.8 (Req) ************/ +e839 /* storage class assumed static */ +elib(839) -append(839,[MISRA 2012 Rule 8.8, required]) /**** Rule 8.9 (Adv) ************/ +e9003 /* could define variable at block scope */ +elib(9003) -append(9003,[MISRA 2012 Rule 8.9, advisory]) /**** Rule 8.10 (Req) ************/ +e695 /* inline function without storage-class specifier */ +elib(695) -append(695,[MISRA 2012 Rule 8.10, required]) +estring(9056,extern) /* inline function defined with extern */ -append(9056,[MISRA 2012 Rule 8.10, required]) /**** Rule 8.11 (Adv) ************/ +e9067 /* array has no dimension or initializer */ +elib(9067) -append(9067,[MISRA 2012 Rule 8.11, advisory]) /**** Rule 8.12 (Req) ************/ +e488 /* duplicate enumerator values */ +elib(488) -append(488,[MISRA 2012 Rule 8.12, required]) /**** Rule 8.13 (Adv) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e818 /* pointer could be declared pointing to const */ +elib(818) -append(818,[MISRA 2012 Rule 8.13, advisory]) +e844 /* pointer could be declared pointing to const */ +elib(844) -append(844,[MISRA 2012 Rule 8.13, advisory]) +e954 /* pointer could be declared pointing to const */ +elib(954) -append(954,[MISRA 2012 Rule 8.13, advisory]) -fcv /* report parameters even if exclusively cast to void */ /**** Rule 8.14 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(keyword,restrict,[MISRA 2012 Rule 8.14, required]) /**** Rule 9.1 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e644 /* Symbol may not have been initialized */ +elib(644) -append(644,[MISRA 2012 Rule 9.1, mandatory]) +e530 /* Symbol not initialized */ +elib(530) -append(530,[MISRA 2012 Rule 9.1, mandatory]) /* 603 - argument to parameter of type pointer to const may be a pointer to uninitialized memory */ +e603 +elib(603) -append(603,[MISRA 2012 Rule 9.1, mandatory]) /**** Rule 9.2 (Req) ************/ +e9069 /* aggregate initialize needs braces or designator */ +elib(9069) -append(9069,[MISRA 2012 Rule 9.2, required]) /**** Rule 9.3 (Req) ************/ +e9068 /* too few initializers */ +elib(9068) -append(9068,[MISRA 2012 Rule 9.3, required]) /**** Rule 9.4 (Req) ************/ +e485 /* duplicate initialization */ +elib(485) -append(485,[MISRA 2012 Rule 9.4, required]) /**** Rule 9.5 (Req) ************/ +e9054 /* designated initializer and dimensionless array */ +elib(9054) -append(9054,[MISRA 2012 Rule 9.5, required]) /**** Rule 10.1 (Req) ************/ +e48 /* bad type */ +elib(48) -append(48,[MISRA 2012 Rule 10.1, required]) +e9027 /* unpermitted operand */ +elib(9027) -append(9027,[MISRA 2012 Rule 10.1, required]) /**** Rule 10.2 (Req) ************/ +e9028 /* unpermitted arithmetic */ +elib(9028) -append(9028,[MISRA 2012 Rule 10.2, required]) /**** Rule 10.3 (Req) ************/ +e9034 /* expression assigned to narrower or different essential type */ +elib(9034) -estring(9052, true, false) -append(9034,[MISRA 2012 Rule 10.3, required]) /**** Rule 10.4 (Req) ************/ +e9029 /* mismatched essential type */ +elib(9029) -append(9029,[MISRA 2012 Rule 10.4, required]) /**** Rule 10.5 (Adv) ************/ +e9030 /* impermissible cast */ +elib(9030) -append(9030,[MISRA 2012 Rule 10.5, advisory]) /**** Rule 10.6 (Req) ************/ +e9031 /* composite expression assigned to wider essential type */ +elib(9031) -append(9031,[MISRA 2012 Rule 10.6, required]) /**** Rule 10.7 (Req) ************/ +e9032 /* composite expression with smaller essential type than other operand*/ +elib(9032) -append(9032,[MISRA 2012 Rule 10.7, required]) /**** Rule 10.8 (Req) ************/ +e9033 /* impermissible cast of composite expression */ +elib(9033) -append(9033,[MISRA 2012 Rule 10.8, required]) /**** Rule 11.1 (Req) ************/ /* 176 - cannot cast non-pointer non-integer to function pointer */ +e176 +elib(176) -append(176,[MISRA 2012 Rule 11.1, required]) /* 178 - cannot cast function pointer to non-pointer non-integer */ +e178 +elib(178) -append(178,[MISRA 2012 Rule 11.1, required]) +e9074 /* conversion between a pointer to function and another type */ +elib(9074) -append(9074,[MISRA 2012 Rule 11.1, required]) /**** Rule 11.2 (Req) ************/ +e9076 /* conversion between a pointer to incomplete type and another type */ +elib(9076) -append(9076,[MISRA 2012 Rule 11.2, required]) /**** Rule 11.3 (Req) ************/ +e9087 /* cast from pointer to pointer */ +elib(9087) -append(9087,[MISRA 2012 Rule 11.3, required]) /**** Rule 11.4 (Adv) ************/ +e9078 /* cast pointer/integer */ +elib(9078) -append(9078,[MISRA 2012 Rule 11.4, advisory]) /**** Rule 11.5 (Adv) ************/ +e9079 /* cast from pointer to pointer */ +elib(9079) -append(9079,[MISRA 2012 Rule 11.5, advisory]) /**** Rule 11.6 (Req) ************/ +elib(923) /* cast pointer/non-pointer */ +etype(923, void *) -append(923,[MISRA 2012 Rule 11.6, required]) /**** Rule 11.7 (Req) ************/ +e177 /* type cannot be cast to object pointer */ +elib(177) -append(177,[MISRA 2012 Rule 11.7, required]) +e179 /* object pointer cannot be cast to type */ +elib(179) -append(179,[MISRA 2012 Rule 11.7, required]) +e9295 /* cast between object pointer and forbidden essential type */ +elib(9295) -append(9295,[MISRA 2012 Rule 11.7, required]) /**** Rule 11.8 (Req) ************/ +e9005 /* attempt to cast away const/volatile from pointer or reference */ +elib(9005) -append(9005,[MISRA 2012 Rule 11.8, required]) /**** Rule 11.9 (Req) ************/ +e9080 /* integer null pointer constant */ +elib(9080) -append(9080,[MISRA 2012 Rule 11.9, required]) /**** Rule 12.1 (Adv) ************/ +e9050 /* dependence placed on precedence */ +elib(9050) -append(9050,[MISRA 2012 Rule 12.1, advisory]) +e9097 /* unparenthesized argument to sizeof */ +elib(9097) -append(9097,[MISRA 2012 Rule 12.1, advisory]) /**** Rule 12.2 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e598 /* excessive left shift */ +elib(598) -append(598,[MISRA 2012 Rule 12.2, required]) +e9053 /* shift value exceeds size of LHS */ +elib(9053) -append(9053,[MISRA 2012 Rule 12.2, required]) /**** Rule 12.3 (Adv) ************/ +e9008 /* comma operator used */ +elib(9008) -append(9008,[MISRA 2012 Rule 12.3, advisory]) /**** Rule 12.4 (Adv) ************/ /* not currently supported */ /**** Rule 13.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e446 /* side effect in initializer */ +elib(446) -append(446,[MISRA 2012 Rule 13.1, required]) /**** Rule 13.2 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e564 /* variable depends on order of evaluation */ +elib(564) -append(564,[MISRA 2012 Rule 13.2, required]) /**** Rule 13.3 (Adv) ************/ +e9049 /* increment/decrement combined with other operations */ +elib(9049) -append(9049,[MISRA 2012 Rule 13.3, advisory]) /**** Rule 13.4 (Adv) ************/ +e720 /* Boolean test of assignment */ +elib(720) -append(720,[MISRA 2012 Rule 13.4, advisory]) +e820 /* Boolean test of parenthesized assignment */ +elib(820) -append(820,[MISRA 2012 Rule 13.4, advisory]) +e9084 /* assignment used inside larger expression */ +elib(9084) -append(9084,[MISRA 2012 Rule 13.4, advisory]) /**** Rule 13.5 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e9007 /* side effects on right hand side of logical operator */ +elib(9007) -append(9007,[MISRA 2012 Rule 13.5, required]) /**** Rule 13.6 (Mand) ************/ +e9006 /* sizeof used with expression with side effect */ +elib(9006) -append(9006,[MISRA 2012 Rule 13.6, mandatory]) +e9089 /* potential side-effect in argument to sizeof */ +elib(9089) -append(9089,[MISRA 2012 Rule 13.6, mandatory]) /**** Rule 14.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e9009 /* floating point variable used as loop counter */ +elib(9009) -append(9009,[MISRA 2012 Rule 14.1, required]) /**** Rule 14.2 (Req) ************/ /* Not currently supported */ /**** Rule 14.3 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e685 /* relational always evaluates to true/false */ +elib(685) -append(685,[MISRA 2012 Rule 14.3, required]) +e774 /* boolean always evaluates to true/false */ +elib(774) -append(774,[MISRA 2012 Rule 14.3, required]) +e650 /* constant out of range for operator */ +elib(650) -append(650,[MISRA 2012 Rule 14.3, required]) /**** Rule 14.4 (Req) ************/ +e9036 /* condition should have essentially Boolean type */ +elib(9036) -append(9036,[MISRA 2012 Rule 14.4, required]) /**** Rule 15.1 (Adv) ************/ +e801 /* use of 'goto' is deprecated */ +elib(801) -append(801,[MISRA 2012 Rule 15.1, advisory]) /**** Rule 15.2 (Req) ************/ +e9064 /* goto references earlier label */ +elib(9064) -append(9064,[MISRA 2012 Rule 15.2, required]) /**** Rule 15.3 (Req) ************/ +e9041 /* goto not nested in the same block as label */ +elib(9041) -append(9041,[MISRA 2012 Rule 15.3, required]) /**** Rule 15.4 (Adv) ************/ +e9011 /* more than one 'break' terminates loop */ +elib(9011) -append(9011,[MISRA 2012 Rule 15.4, advisory]) /**** Rule 15.5 (Adv) ************/ +e904 /* return before function end */ +elib(904) -append(904,[MISRA 2012 Rule 15.5, advisory]) /**** Rule 15.6 (Req) ************/ +e9012 /* sub-statement should be a compound statement */ +elib(9012) -append(9012,[MISRA 2012 Rule 15.6, required]) /**** Rule 15.7 (Req) ************/ +e9013 /* no 'else' at end of 'if ... else if' chain */ +elib(9013) -append(9013,[MISRA 2012 Rule 15.7, required]) +e9063 /* no comment or action in else-branch */ +elib(9063) -append(9063,[MISRA 2012 Rule 15.7, required]) /**** Rule 16.1 (Req) ************/ +e616 /* control flows into case/default */ +elib(616) -append(616,[MISRA 2012 Rule 16.1, required]) +e744 /* switch statement has no default */ +elib(744) -append(744,[MISRA 2012 Rule 16.1, required]) +e764 /* switch does not have a case */ +elib(764) -append(764,[MISRA 2012 Rule 16.1, required]) +e825 /* control flows into case/default without -fallthrough comment */ +elib(825) -append(825,[MISRA 2012 Rule 16.1, required]) +e9014 /* default missing from switch */ +elib(9014) -append(9014,[MISRA 2012 Rule 16.1, required]) +e9042 /* departure from MISRA switch syntax */ +elib(9042) -append(9042,[MISRA 2012 Rule 16.1, required]) +e9077 /* missing unconditional break */ +elib(9077) -append(9077,[MISRA 2012 Rule 16.1, required]) +e9081 /* too few independent cases for switch */ +elib(9081) -append(9081,[MISRA 2012 Rule 16.1, required]) +e9082 /* switch statement should either begin or end with default label */ +elib(9082) -append(9082,[MISRA 2012 Rule 16.1, required]) +e9085 /* statement or comment should appear in default case */ +elib(9085) -append(9085,[MISRA 2012 Rule 16.1, required]) /**** Rule 16.2 (Req) ************/ +e44 /* Need a switch */ +elib(44) -append(44,[MISRA 2012 Rule 16.2, required]) +e9055 /* enclosing statement is not a switch */ +elib(9055) -append(9055,[MISRA 2012 Rule 16.2, required]) /**** Rule 16.3 (Req) ************/ +e616 /* control flows into case/default */ +elib(616) -append(616,[MISRA 2012 Rule 16.3, required]) +e825 /* control flows into case/default without -fallthrough comment */ +elib(825) -append(825,[MISRA 2012 Rule 16.3, required]) +e9077 /* missing unconditional break */ +elib(9077) -append(9077,[MISRA 2012 Rule 16.3, required]) +e9090 /* missing unconditional break */ +elib(9090) -append(9090,[MISRA 2012 Rule 16.3, required]) /**** Rule 16.4 (Req) ************/ +e744 /* switch statement has no default */ +elib(744) -append(744,[MISRA 2012 Rule 16.4, required]) +e9014 /* switch statement has no default */ +elib(9014) -append(9014,[MISRA 2012 Rule 16.4, required]) +e9085 /* default case has no statement nor comment */ +elib(9085) -append(9085,[MISRA 2012 Rule 16.4, required]) /**** Rule 16.5 (Req) ************/ +e9082 /* default should be first or last */ +elib(9082) -append(9082,[MISRA 2012 Rule 16.5, required]) /**** Rule 16.6 (Req) ************/ +e764 /* switch does not have a case */ +elib(764) -append(764,[MISRA 2012 Rule 16.6, required]) +e9081 /* too few cases */ +elib(9081) -append(9081,[MISRA 2012 Rule 16.6, required]) /**** Rule 16.7 (Req) ************/ +e483 /* boolean value in switch expression */ +elib(483) -append(483,[MISRA 2012 Rule 16.7, required]) /**** Rule 17.1 (Req) ************/ +e829 /* warn on header usage */ +elib(829) +headerwarn(stdarg.h) -append(829(stdarg.h),[MISRA 2012 Rule 17.1, required]) -deprecate(macro,va_arg,[MISRA 2012 Rule 17.1, required]) -deprecate(macro,va_start,[MISRA 2012 Rule 17.1, required]) -deprecate(macro,va_end,[MISRA 2012 Rule 17.1, required]) -deprecate(macro,va_copy,[MISRA 2012 Rule 17.1, required]) -deprecate(type,va_list,[MISRA 2012 Rule 17.1, required]) /**** Rule 17.2 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e9070 -append(9070,[MISRA 2012 Rule 17.2, required]) /**** Rule 17.3 (Mand) ************/ +e718 /* symbol undeclared, assumed to return int */ +elib(718) -append(718,[MISRA 2012 Rule 17.3, mandatory]) /**** Rule 17.4 (Mand) ************/ +e533 /* function should return a value */ +elib(533) -append(533,[MISRA 2012 Rule 17.4, mandatory]) /**** Rule 17.5 (Adv) ************/ /* MISRA has declared this rule to be "undecidable". */ +e473 /* argument to array parameter too small */ +elib(473) -append(473,[MISRA 2012 Rule 17.5, advisory]) /**** Rule 17.6 (Mand) ************/ +e9043 /* static between brackets of array declaration */ +elib(9043) -append(9043,[MISRA 2012 Rule 17.6, mandatory]) /**** Rule 17.7 (Req) ************/ +e534 /* ignoring return value of function */ +elib(534) -append(534,[MISRA 2012 Rule 17.7, required]) /**** Rule 17.8 (Adv) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e9044 /* function parameter modified */ +elib(9044) -append(9044,[MISRA 2012 Rule 17.8, advisory]) /**** Rule 18.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e415 /* out-of-bounds pointer */ +elib(415) -append(415,[MISRA 2012 Rule 18.1, required]) +e416 /* out-of-bounds pointer */ +elib(416) -append(416,[MISRA 2012 Rule 18.1, required]) +e428 /* out-of-bounds pointer */ +elib(428) -append(428,[MISRA 2012 Rule 18.1, required]) +e661 /* out-of-bounds pointer */ +elib(661) -append(661,[MISRA 2012 Rule 18.1, required]) +e662 /* out-of-bounds pointer */ +elib(662) -append(662,[MISRA 2012 Rule 18.1, required]) +e676 /* out-of-bounds pointer */ +elib(676) -append(676,[MISRA 2012 Rule 18.1, required]) /**** Rule 18.2 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e947 /* pointer subtraction */ +elib(947) -append(947,[MISRA 2012 Rule 18.2, required]) /**** Rule 18.3 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e946 /* relational operator applied to pointers */ +elib(946) -append(946,[MISRA 2012 Rule 18.3, required]) /**** Rule 18.4 (Adv) ************/ +e9016 /* pointer arithmetic other than array indexing used */ +elib(9016) -append(9016,[MISRA 2012 Rule 18.4, advisory]) /**** Rule 18.5 (Adv) ************/ +e9025 /* more than two pointer indirection levels used */ +elib(9025) -append(9025,[MISRA 2012 Rule 18.5, advisory]) /**** Rule 18.6 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e733 /* assigning address of auto to outer scope symbol */ +elib(733) -append(733,[MISRA 2012 Rule 18.6, required]) +e789 /* assigning address of auto to static */ +elib(789) -append(789,[MISRA 2012 Rule 18.6, required]) +e604 /* returning address of auto variable */ +elib(604) -append(604,[MISRA 2012 Rule 18.6, required]) /**** Rule 18.7 (Req) ************/ +e9038 /* flexible array member declared */ +elib(9038) -append(9038,[MISRA 2012 Rule 18.7, required]) /**** Rule 18.8 (Req) ************/ +e9035 /* variable length array declared */ +elib(9035) -append(9035,[MISRA 2012 Rule 18.8, required]) /**** Rule 19.1 (Mand) ************/ /* MISRA has declared this rule to be "undecidable". */ /**** Rule 19.2 (Adv) ************/ +e9018 /* union type/object declared */ +elib(9018) -append(9018,[MISRA 2012 Rule 19.2, advisory]) /**** Rule 20.1 (Adv) ************/ +e9019 /* declaration before #include */ +elib(9019) -append(9019,[MISRA 2012 Rule 20.1, advisory]) /**** Rule 20.2 (Req) ************/ +e9020 /* header file name with non-standard character */ +elib(9020) -append(9020,[MISRA 2012 Rule 20.2, required]) /* Note: If your system requires the '\' be used as a directory separator, uncomment the following option. */ // -estring(9020,\) /**** Rule 20.3 (Req) ************/ +e12 /* Need < or " after #include */ +elib(12) -append(12,[MISRA 2012 Rule 20.3, required]) /* 544 directive not followed by EOL */ +estring(544,include) +elib(544) -append(544(include),[MISRA 2012 Rule 20.3, required]) /**** Rule 20.4 (Req) ************/ +e9051 /* macro with same name as a keyword */ +elib(9051) -append(9051,[MISRA 2012 Rule 20.4, required]) /**** Rule 20.5 (Adv) ************/ +e9021 /* use of '#undef' is discouraged */ +elib(9021) -append(9021,[MISRA 2012 Rule 20.5, advisory]) /**** Rule 20.6 (Req) ************/ +e436 /* preprocessor directive in invocation of macro */ +elib(436) -append(436,[MISRA 2012 Rule 20.6, required]) /**** Rule 20.7 (Req) ************/ +e665 /* expression passed to unparenthesized macro */ +elib(665) -append(665,[MISRA 2012 Rule 20.7, required]) /**** Rule 20.8 (Req) ************/ +e9037 /* conditional of #if/#elif does not evaluate to 0 or 1 */ +elib(9037) -append(9037,[MISRA 2012 Rule 20.8, required]) /**** Rule 20.9 (Req) ************/ +e553 /* Undefined preprocessor variable, assumed 0 */ +elib(553) -append(553,[MISRA 2012 Rule 20.9, required]) /**** Rule 20.10 (Adv) ************/ +e9024 /* '#/##' operators used */ +elib(9024) -append(9024,[MISRA 2012 Rule 20.10, advisory]) /**** Rule 20.11 (Req) ************/ +e484 /* stringize operator followed by macro parameter followed by pasting operator */ +elib(484) -append(484,[MISRA 2012 Rule 20.11, required]) /**** Rule 20.12 (Req) ************/ +e9015 /* macro parameter used with and without '#/##' subject to further replacement */ +elib(9015) -append(9015,[MISRA 2012 Rule 20.12, required]) /**** Rule 20.13 (Req) ************/ /* 544 - directive not followed by EOL */ +e544 +elib(544) -append(544,[MISRA 2012 Rule 20.13, required]) /* 16 - unknown preprocessor directive */ +e16 +elib(16) -append(16,[MISRA 2012 Rule 20.13, required]) /* 9160 - unknown preprocessor directive in conditionally excluded region */ +e9160 +elib(9160) -append(9160,[MISRA 2012 Rule 20.13, required]) /**** Rule 20.14 (Req) ************/ +e8 /* unclosed #if */ +elib(8) -append(8,[MISRA 2012 Rule 20.14, required]) /**** Rule 21.1 (Req) ************/ +e136 /* Illegal macro name */ +elib(136) -append(136,[MISRA 2012 Rule 21.1, required]) /* Undefining standard library macros is covered by rule 20.5. */ /* Defining/redefining reserved/standard identifiers is covered by rules 20.4 and 21.2. */ +e9071 /* defined macro reserved to the compiler */ +elib(9071) -append(9071,[MISRA 2012 Rule 21.1, required]) // explicit exemptions -estring(9071,* because *) -estring(9071,cerf) -estring(9071,cerfc) -estring(9071,cexp2) -estring(9071,cexpm1) -estring(9071,clog10) -estring(9071,clog1p) -estring(9071,clog2) -estring(9071,clgamma) -estring(9071,ctgamma) -estring(9071,cerff) -estring(9071,cerfcf) -estring(9071,cexp2f) -estring(9071,cexpm1f) -estring(9071,clog10f) -estring(9071,clog1pf) -estring(9071,clog2f) -estring(9071,clgammaf) -estring(9071,ctgammaf) -estring(9071,cerfl) -estring(9071,cerfcl) -estring(9071,cexp2l) -estring(9071,cexpm1l) -estring(9071,clog10l) -estring(9071,clog1pl) -estring(9071,clog2l) -estring(9071,clgammal) -estring(9071,ctgammal) -estring(9071,E0*) -estring(9071,E1*) -estring(9071,E2*) -estring(9071,E3*) -estring(9071,E4*) -estring(9071,E5*) -estring(9071,E6*) -estring(9071,E7*) -estring(9071,E8*) -estring(9071,E9*) -estring(9071,NDEBUG) -estring(9071,PRIa*) -estring(9071,PRIb*) -estring(9071,PRIc*) -estring(9071,PRId*) -estring(9071,PRIe*) -estring(9071,PRIf*) -estring(9071,PRIg*) -estring(9071,PRIh*) -estring(9071,PRIi*) -estring(9071,PRIj*) -estring(9071,PRIk*) -estring(9071,PRIl*) -estring(9071,PRIm*) -estring(9071,PRIn*) -estring(9071,PRIo*) -estring(9071,PRIp*) -estring(9071,PRIq*) -estring(9071,PRIr*) -estring(9071,PRIs*) -estring(9071,PRIt*) -estring(9071,PRIu*) -estring(9071,PRIv*) -estring(9071,PRIw*) -estring(9071,PRIx*) -estring(9071,PRIy*) -estring(9071,PRIz*) -estring(9071,PRIX*) -estring(9071,SCNa*) -estring(9071,SCNb*) -estring(9071,SCNc*) -estring(9071,SCNd*) -estring(9071,SCNe*) -estring(9071,SCNf*) -estring(9071,SCNg*) -estring(9071,SCNh*) -estring(9071,SCNi*) -estring(9071,SCNj*) -estring(9071,SCNk*) -estring(9071,SCNl*) -estring(9071,SCNm*) -estring(9071,SCNn*) -estring(9071,SCNo*) -estring(9071,SCNp*) -estring(9071,SCNq*) -estring(9071,SCNr*) -estring(9071,SCNs*) -estring(9071,SCNt*) -estring(9071,SCNu*) -estring(9071,SCNv*) -estring(9071,SCNw*) -estring(9071,SCNx*) -estring(9071,SCNy*) -estring(9071,SCNz*) -estring(9071,SCNX*) +e9083 /* undefined macro reserved to the compiler */ +elib(9083) -append(9083,[MISRA 2012 Rule 21.1, required]) // explicit exemptions -estring(9083,* because *) -estring(9083,cerf) -estring(9083,cerfc) -estring(9083,cexp2) -estring(9083,cexpm1) -estring(9083,clog10) -estring(9083,clog1p) -estring(9083,clog2) -estring(9083,clgamma) -estring(9083,ctgamma) -estring(9083,cerff) -estring(9083,cerfcf) -estring(9083,cexp2f) -estring(9083,cexpm1f) -estring(9083,clog10f) -estring(9083,clog1pf) -estring(9083,clog2f) -estring(9083,clgammaf) -estring(9083,ctgammaf) -estring(9083,cerfl) -estring(9083,cerfcl) -estring(9083,cexp2l) -estring(9083,cexpm1l) -estring(9083,clog10l) -estring(9083,clog1pl) -estring(9083,clog2l) -estring(9083,clgammal) -estring(9083,ctgammal) -estring(9083,E0*) -estring(9083,E1*) -estring(9083,E2*) -estring(9083,E3*) -estring(9083,E4*) -estring(9083,E5*) -estring(9083,E6*) -estring(9083,E7*) -estring(9083,E8*) -estring(9083,E9*) -estring(9083,NDEBUG) -estring(9083,PRIa*) -estring(9083,PRIb*) -estring(9083,PRIc*) -estring(9083,PRId*) -estring(9083,PRIe*) -estring(9083,PRIf*) -estring(9083,PRIg*) -estring(9083,PRIh*) -estring(9083,PRIi*) -estring(9083,PRIj*) -estring(9083,PRIk*) -estring(9083,PRIl*) -estring(9083,PRIm*) -estring(9083,PRIn*) -estring(9083,PRIo*) -estring(9083,PRIp*) -estring(9083,PRIq*) -estring(9083,PRIr*) -estring(9083,PRIs*) -estring(9083,PRIt*) -estring(9083,PRIu*) -estring(9083,PRIv*) -estring(9083,PRIw*) -estring(9083,PRIx*) -estring(9083,PRIy*) -estring(9083,PRIz*) -estring(9083,PRIX*) -estring(9083,SCNa*) -estring(9083,SCNb*) -estring(9083,SCNc*) -estring(9083,SCNd*) -estring(9083,SCNe*) -estring(9083,SCNf*) -estring(9083,SCNg*) -estring(9083,SCNh*) -estring(9083,SCNi*) -estring(9083,SCNj*) -estring(9083,SCNk*) -estring(9083,SCNl*) -estring(9083,SCNm*) -estring(9083,SCNn*) -estring(9083,SCNo*) -estring(9083,SCNp*) -estring(9083,SCNq*) -estring(9083,SCNr*) -estring(9083,SCNs*) -estring(9083,SCNt*) -estring(9083,SCNu*) -estring(9083,SCNv*) -estring(9083,SCNw*) -estring(9083,SCNx*) -estring(9083,SCNy*) -estring(9083,SCNz*) -estring(9083,SCNX*) /**** Rule 21.2 (Req) ************/ +e9093 /* name is reserved to the compiler */ +elib(9093) -append(9093,[MISRA 2012 Rule 21.2, required]) /**** Rule 21.3 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,calloc,[MISRA 2012 Rule 21.3, required]) -deprecate(macro,calloc,[MISRA 2012 Rule 21.3, required]) -deprecate(function,malloc,[MISRA 2012 Rule 21.3, required]) -deprecate(macro,malloc,[MISRA 2012 Rule 21.3, required]) -deprecate(function,realloc,[MISRA 2012 Rule 21.3, required]) -deprecate(macro,realloc,[MISRA 2012 Rule 21.3, required]) -deprecate(function,free,[MISRA 2012 Rule 21.3, required]) -deprecate(macro,free,[MISRA 2012 Rule 21.3, required]) /**** Rule 21.4 (Req) ************/ +e829 /* warn on header usage */ +elib(829) +headerwarn(setjmp.h) -append(829(setjmp.h),[MISRA 2012 Rule 21.4, required]) -deprecate(function,setjmp,[MISRA 2012 Rule 21.4, required]) -deprecate(function,longjmp,[MISRA 2012 Rule 21.4, required]) -deprecate(macro,setjmp,[MISRA 2012 Rule 21.4, required]) -deprecate(macro,longjmp,[MISRA 2012 Rule 21.4, required]) -deprecate(type,jmp_buf,[MISRA 2012 Rule 21.4, required]) /**** Rule 21.5 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,signal,[MISRA 2012 Rule 21.5, required]) -deprecate(function,raise,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGABRT,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGFPE,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGILL,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGINT,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGSEGV,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIGTERM,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIG_DFL,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIG_ERR,[MISRA 2012 Rule 21.5, required]) -deprecate(macro,SIG_IGN,[MISRA 2012 Rule 21.5, required]) -deprecate(type,sig_atomic_t,[MISRA 2012 Rule 21.5, required]) +e829 /* warn on header usage */ +elib(829) +headerwarn(signal.h) -append(829(signal.h),[MISRA 2012 Rule 21.5, required]) /**** Rule 21.6 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,clearerr,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fclose,[MISRA 2012 Rule 21.6, required]) -deprecate(function,feof,[MISRA 2012 Rule 21.6, required]) -deprecate(function,ferror,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fflush,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fgetc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fgetpos,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fgets,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fgetwc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fgetws,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fopen,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fputc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fputs,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fputwc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fputws,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fread,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fseek,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fsetpos,[MISRA 2012 Rule 21.6, required]) -deprecate(function,freopen,[MISRA 2012 Rule 21.6, required]) -deprecate(function,ftell,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fwide,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fwrite,[MISRA 2012 Rule 21.6, required]) -deprecate(function,fwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,getc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,getchar,[MISRA 2012 Rule 21.6, required]) -deprecate(function,gets,[MISRA 2012 Rule 21.6, required]) -deprecate(function,getwc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,getwchar,[MISRA 2012 Rule 21.6, required]) -deprecate(function,perror,[MISRA 2012 Rule 21.6, required]) -deprecate(function,printf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,putc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,putchar,[MISRA 2012 Rule 21.6, required]) -deprecate(function,puts,[MISRA 2012 Rule 21.6, required]) -deprecate(function,putwc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,putwchar,[MISRA 2012 Rule 21.6, required]) -deprecate(function,remove,[MISRA 2012 Rule 21.6, required]) -deprecate(function,rename,[MISRA 2012 Rule 21.6, required]) -deprecate(function,rewind,[MISRA 2012 Rule 21.6, required]) -deprecate(function,scanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,setbuf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,setvbuf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,snprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,sprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,sscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,swprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,swscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,tmpfile,[MISRA 2012 Rule 21.6, required]) -deprecate(function,tmpnam,[MISRA 2012 Rule 21.6, required]) -deprecate(function,ungetc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,ungetwc,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vfprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vfscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vfwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vfwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vsnprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vsprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vsscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vswprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vswscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,vwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,wprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(function,wscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,clearerr,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fclose,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,feof,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,ferror,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fflush,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fgetc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fgets,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fgetpos,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fgetwc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fgetws,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fopen,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fputc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fputs,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fputwc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fputws,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fread,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fseek,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fsetpos,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,freopen,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,ftell,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fwide,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fwrite,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,fwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,getc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,getchar,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,gets,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,getwc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,getwchar,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,perror,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,printf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,putc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,putchar,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,puts,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,putwc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,putwchar,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,remove,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,rename,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,rewind,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,scanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,setbuf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,setvbuf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,snprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,sprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,sscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,swprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,swscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,tmpfile,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,tmpnam,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,ungetc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,ungetwc,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vfprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vfscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vfwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vfwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vsnprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vsprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vsscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vswprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vswscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vwprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,vwscanf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,wprintf,[MISRA 2012 Rule 21.6, required]) -deprecate(macro,wscanf,[MISRA 2012 Rule 21.6, required]) /**** Rule 21.7 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,atof,[MISRA 2012 Rule 21.7, required]) -deprecate(function,atoi,[MISRA 2012 Rule 21.7, required]) -deprecate(function,atol,[MISRA 2012 Rule 21.7, required]) -deprecate(function,atoll,[MISRA 2012 Rule 21.7, required]) -deprecate(macro,atof,[MISRA 2012 Rule 21.7, required]) -deprecate(macro,atoi,[MISRA 2012 Rule 21.7, required]) -deprecate(macro,atol,[MISRA 2012 Rule 21.7, required]) -deprecate(macro,atoll,[MISRA 2012 Rule 21.7, required]) /**** Rule 21.8 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,abort,[MISRA 2012 Rule 21.8, required]) -deprecate(function,exit,[MISRA 2012 Rule 21.8, required]) -deprecate(function,getenv,[MISRA 2012 Rule 21.8, required]) -deprecate(function,system,[MISRA 2012 Rule 21.8, required]) -deprecate(macro,abort,[MISRA 2012 Rule 21.8, required]) -deprecate(macro,exit,[MISRA 2012 Rule 21.8, required]) -deprecate(macro,getenv,[MISRA 2012 Rule 21.8, required]) -deprecate(macro,system,[MISRA 2012 Rule 21.8, required]) /**** Rule 21.9 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,bsearch,[MISRA 2012 Rule 21.9, required]) -deprecate(function,qsort,[MISRA 2012 Rule 21.9, required]) -deprecate(macro,bsearch,[MISRA 2012 Rule 21.9, required]) -deprecate(macro,qsort,[MISRA 2012 Rule 21.9, required]) /**** Rule 21.10 (Req) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(macro,wcsftime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,wcsftime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,clock,[MISRA 2012 Rule 21.10, required]) -deprecate(function,clock,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,difftime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,difftime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,mktime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,mktime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,time,[MISRA 2012 Rule 21.10, required]) -deprecate(function,time,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,asctime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,asctime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,ctime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,ctime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,gmtime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,gmtime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,localtime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,localtime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,strftime,[MISRA 2012 Rule 21.10, required]) -deprecate(function,strftime,[MISRA 2012 Rule 21.10, required]) -deprecate(macro,CLOCKS_PER_SEC,[MISRA 2012 Rule 21.10, required]) -deprecate(type,clock_t,[MISRA 2012 Rule 21.10, required]) -deprecate(type,time_t,[MISRA 2012 Rule 21.10, required]) -deprecate(type,struct tm,[MISRA 2012 Rule 21.10, required]) +e829 /* warn on header usage */ +elib(829) +headerwarn(time.h) -append(829(time.h),[MISRA 2012 Rule 21.10, required]) /**** Rule 21.11 (Req) ************/ +e829 /* warn on header usage */ +elib(829) +headerwarn(tgmath.h) -append(829(tgmath.h),[MISRA 2012 Rule 21.11, required]) /**** Rule 21.12 (Adv) ************/ +e586 /* Symbol is deprecated */ +elib(586) -deprecate(function,feclearexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,feclearexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(function,fegetexceptflag,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,fegetexceptflag,[MISRA 2012 Rule 21.12, advisory]) -deprecate(function,feraiseexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,feraiseexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(function,fesetexceptflag,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,fesetexceptflag,[MISRA 2012 Rule 21.12, advisory]) -deprecate(function,fetestexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,fetestexcept,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_INEXACT,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_DIVBYZERO,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_UNDERFLOW,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_OVERFLOW,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_INVALID,[MISRA 2012 Rule 21.12, advisory]) -deprecate(macro,FE_ALL_EXCEPT,[MISRA 2012 Rule 21.12, advisory]) /**** Rule 22.1 (Req) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e429 /* custodial pointer neither free'd nor returned */ +elib(429) -append(429,[MISRA 2012 Rule 22.1, required]) /* 698 - in-place realloc could cause a memory leak */ +e698 +elib(698) -append(698,[MISRA 2012 Rule 22.1, required]) /**** Rule 22.2 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e424 /* inappropriate deallocation */ +elib(424) -append(424,[MISRA 2012 Rule 22.2, mandatory]) +e449 /* pointer previously deallocated */ +elib(449) -append(449,[MISRA 2012 Rule 22.2, mandatory]) /**** Rule 22.3 (Req) ************/ /* MISRA has declared this rule to be "undecidable". */ /**** Rule 22.4 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e2477 /* attempt to perform write operation on stream not opened for writing */ +elib(2477) -append(2477,[MISRA 2012 Rule 22.4, mandatory]) /**** Rule 22.5 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel Software provides the following message to assist: */ +e9047 /* FILE pointer dereferenced */ +elib(9047) -append(9047,[MISRA 2012 Rule 22.5, mandatory]) /**** Rule 22.6 (Mand) ************/ /* While MISRA has declared this rule to be "undecidable", Gimpel * Software provides the following options to assist: */ +e2471 /* operation on stream that has been closed */ +elib(2471) -append(2471,[MISRA 2012 Rule 22.6, mandatory]) ================================================ FILE: ports/lint-plus/lin.bat ================================================ @echo off :: =========================================================================== :: Product: QP/C build script for PC-Lint-Plus :: Last Updated for Version: 6.8.0 :: Date of the Last Update: 2020-01-26 :: :: Q u a n t u m L e a P s :: ------------------------ :: Modern Embedded Software :: :: Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. :: :: This program is open source software: you can redistribute it and/or :: modify it under the terms of the GNU General Public License as published :: by the Free Software Foundation, either version 3 of the License, or :: (at your option) any later version. :: :: Alternatively, this program may be distributed and modified under the :: terms of Quantum Leaps commercial licenses, which expressly supersede :: the GNU General Public License and are specifically designed for :: licensees interested in retaining the proprietary status of their code. :: :: This program is distributed in the hope that it will be useful, :: but WITHOUT ANY WARRANTY; without even the implied warranty of :: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the :: GNU General Public License for more details. :: :: You should have received a copy of the GNU General Public License :: along with this program. If not, see . :: :: Contact information: :: :: :: =========================================================================== @setlocal :: usage of lin.bat @echo Usage: lin [16bit] [-d...] @echo examples: @echo lin -dFOO : use 32bit CPU (default) and define Q_SPY and Q_UTEST @echo lin 16bit -dBAR : use 16bit CPU includes and define Q_SPY @echo. :: NOTE: adjust to for your installation directory of PC-Lint-Plus @set PCLP=C:\tools\lint-plus\pclp32.exe if NOT exist "%PCLP%" ( @echo The PC-Lint-Plus toolset not found. Please adjust lin.bat @goto end ) :: set the QP-nano directory set QPN=..\.. if "%1"=="16bit" ( set LINTFLAGS=std.lnt -i16bit options.lnt %2 %3 %4 @echo 16bit CPU ) else ( set LINTFLAGS=std.lnt -i32bit options.lnt %1 %2 %3 %4 @echo 32bit CPU default ) :: cleanup @del *.log :: linting ------------------------------------------------------------------- %PCLP% -os(lint_qfn.log) %LINTFLAGS% -iqvn ..\..\src\qfn\*.c %PCLP% -os(lint_qkn.log) %LINTFLAGS% -iqkn ..\..\src\qkn\*.c %PCLP% -os(lint_qvn.log) %LINTFLAGS% -iqvn ..\..\src\qvn\*.c :end @endlocal ================================================ FILE: ports/lint-plus/options.lnt ================================================ /// @file /// @brief PC-Lint-Plus option file for linting QP-nano source code /// @cond ///=========================================================================== /// Product: QP-nano /// Last updated for version 6.7.0 /// Last updated on 2019-12-30 /// /// Q u a n t u m L e a P s /// ------------------------ /// Modern Embedded Software /// /// Copyright (C) 2005-2019 Quantum Leaps. All rights reserved. /// /// This program is open source software: you can redistribute it and/or /// modify it under the terms of the GNU General Public License as published /// by the Free Software Foundation, either version 3 of the License, or /// (at your option) any later version. /// /// Alternatively, this program may be distributed and modified under the /// terms of Quantum Leaps commercial licenses, which expressly supersede /// the GNU General Public License and are specifically designed for /// licensees interested in retaining the proprietary status of their code. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program. If not, see . /// /// Contact information: /// /// ///=========================================================================== /// @endcond ///////////////////////////////////////////////////////////////////////////// // general options -unit_check // perform only subset check (suppresses Global Wrapup) -max_threads=1 // suppress message "no '-max_threads=N' option" //-vf // print names of all source files (for debugging linting) // include directories -i. // QP-nano port includes (see also qkn/ and qvn/) -i%QPN%/include // QP-nano public includes -i%QPN%/src // QP-nano package-scope includes // size options corresponding to GNU-ARM -si4 -sl4 -sll8 -ss2 -sw4 -sp4 -sf4 -sd8 -sld8 +fzl // standards au-misra3.lnt // MISRA-C:2012 au-misra3-amd1.lnt // MISRA-C:2012 amendment 1 options au-ds.lnt // Dan Saks recommendations //-strong(AXJ) // Strong type checking ///////////////////////////////////////////////////////////////////////////// // QP-nano options for clients qpn.lnt // QP-nano options ///////////////////////////////////////////////////////////////////////////// // additional suppression rules for building QP/C source code... // QEP-nano ------------------------------------------------------------------ // QF-nano ------------------------------------------------------------------- // QV-nano ------------------------------------------------------------------- // QK-nano ------------------------------------------------------------------- ================================================ FILE: ports/lint-plus/qkn/qfn_port.h ================================================ /** * @file * @brief QF-nano port for Lint, preemptive QK-nano kernel, generic C compiler * @cond ****************************************************************************** * Last updated for version 6.7.0 * Last updated on 2019-12-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /** * @description * This header file contains the port and customization of QP-nano to the * specific CPU and compiler. The port header file is included in the main qpn.h * header file. */ /*! Macro to specify compiler-specific directive for placing a * constant object in ROM. */ /** * @description * Many compilers for 8-bit Harvard-architecture MCUs provide non-stanard * extensions to support placement of objects in different memories. * In order to conserve the precious RAM, QP-nano uses the Q_ROM macro for * all constant objects that can be allocated in ROM. * * To override the following empty definition, you need to define the * Q_ROM macro in the qpn_port.h header file. Some examples of valid * Q_ROM macro definitions are: __code (IAR 8051 compiler), code (Keil * 8051 compiler), PROGMEM (gcc for AVR), __flash (IAR for AVR). */ #define Q_ROM /*! Macro to access a byte allocated in ROM */ /** * @description * Some compilers for Harvard-architecture MCUs, such as gcc for AVR, do * not generate correct code for accessing data allocated in the program * space (ROM). The workaround for such compilers is to explicitly add * assembly code to access each data element allocated in the program * space. The macro Q_ROM_BYTE() retrieves a byte from the given ROM * address. * * The Q_ROM_BYTE() macro should be defined in the qpn_port.h header file * for each compiler that cannot handle correctly data allocated in ROM * (such as the gcc). If the macro is left undefined, the default * definition simply returns the argument and lets the compiler synthesize * the correct code. */ #define Q_ROM_BYTE(rom_var_) (rom_var_) /*! Macro to access a pointer allocated in ROM */ /** * @description * Some compilers for Harvard-architecture MCUs, such as the gcc for AVR, * do not generate correct code for accessing data allocated in the program * space. The workaround for such compilers is to explictly add assembly code * to access each data element allocated in the program space. The macro * Q_ROM_PTR() retrieves an object-pointer from the given ROM address. Please * note that the pointer can be pointing to the object in RAM or ROM. * * The Q_ROM_PTR() macro should be defined in the qpn_port.h header file * for each compiler that cannot handle correctly data allocated in ROM * (such as the gcc). If the macro is left undefined, the default definition * simply returns the argument and lets the compiler synthesize the correct * code. */ #define Q_ROM_PTR(rom_var_) (rom_var_) /*! The macro defines the mechanism of locking the interrupts. */ /** * @note This is just an example of #QF_INT_DISABLE. You need to define * the macro appropriately for the CPU/compiler you're using. * * @note The #QF_INT_DISABLE macro must be always paired with #QF_INT_ENABLE. * You should keep the code between these two macros to the minimum. */ #define QF_INT_DISABLE() int_disable() /*! The macro defines the mechanism of unlocking the interrupts. */ /** * @description * @note This is just an example of #QF_INT_ENABLE. You need to define * the macro appropriately for the CPU/compiler you're using. * * @note The #QF_INT_ENABLE macro must be always paired with #QF_INT_DISABLE. * You should keep the code between these two macros to the minimum. */ #define QF_INT_ENABLE() int_enable() /*! QK-nano ISR entry * * an example only */ #define QK_ISR_ENTRY() ((void)0) /*! QK-nano ISR exit */ #define QK_ISR_EXIT() (*((uint32_t volatile *)0xE000ED04U) = 0x10000000U) /*! Macro that specifies whether QK-nano ISR nesting is allowed */ #define QF_ISR_NEST /*! Macro that specifies QK-nano initialization */ /** * @description * Some QK-nano ports might need initialization (e.g., seeting the priorities * of exceptions PendSV and SVCall in ARM Cortex-M port). The QK_INIT() macro * in this case calls the initialization defined in assembly. * * @note The macro QK_INIT() can be left undefined. */ #define QK_INIT() QK_init() void QK_init(void); /*! Macro that enables context-switch callback in QK-nano */ #define QK_ON_CONTEXT_SW void int_disable(void); /*!< example of a function to disable interrupts */ void int_enable(void); /*!< example of a function to enable interrupts */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/lint-plus/qpn.lnt ================================================ /// @file /// @brief PC-Lint-Plus configuration file for linting QP-nano applications /// @cond ///=========================================================================== /// Product: QP-nano /// Last updated for version 6.7.0 /// Last updated on 2019-12-30 /// /// Q u a n t u m L e a P s /// ------------------------ /// Modern Embedded Software /// /// Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. /// /// This program is open source software: you can redistribute it and/or /// modify it under the terms of the GNU General Public License as published /// by the Free Software Foundation, either version 3 of the License, or /// (at your option) any later version. /// /// Alternatively, this program may be distributed and modified under the /// terms of Quantum Leaps commercial licenses, which expressly supersede /// the GNU General Public License and are specifically designed for /// licensees interested in retaining the proprietary status of their code. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program. If not, see . /// /// Contact information: /// /// ///============================================================================ /// @endcond // M3-D4.8(a) complete definition is unnecessary in this translation unit -efile(9045, -qepn.h, -qfn.h, -qvn.h, -qkn.h, ) // Assertions ---------------------------------------------------------------- // give Q_onAssert() the semantics of "exit" -function(exit, Q_onAssert) // M3-D4.9(a) function-like macro -esym(9026, Q_ASSERT, Q_ASSERT_ID, Q_ALLEGE, Q_ALLEGE_ID, Q_ERROR, Q_ERROR_ID, Q_REQUIRE, Q_REQUIRE_ID, Q_ENSURE, Q_ENSURE_ID, Q_INVARIANT, Q_INVARIANT_ID, Q_ASSERT_STATIC, Q_ASSERT_COMPILE, Q_DEFINE_THIS_MODULE) // definition of macro ends in semi-colon -esym(823, Q_DEFINE_THIS_FILE, Q_DEFINE_THIS_MODULE) // M3-D4.9(adv) function-like macro -esym(9026, Q_DIM, Q_UINT2PTR_CAST) // QEP-nano ------------------------------------------------------------------ // M3-D4.9(adv) function-like macro -esym(9026, QHSM_INIT, QHSM_DISPATCH, Q_STATE_CAST, Q_TRAN, Q_TRAN_HIST, Q_SUPER, Q_HANDLED, Q_UNHANDLED, Q_SIG, Q_PAR, Q_HSM_UPCAST, QHsm_state, QHsm_childState, QP_getVersion) // M3-R11.1(req) conversion between pointer to function type and differing type -emacro(9074, Q_STATE_CAST) // M3-R13.4(a) result of assignment used in left operand to ',' operator -emacro(9084, Q_TRAN, Q_SUPER) // M3-R12.3(a) comma operator used -emacro(9008, Q_TRAN, Q_SUPER) // M3-R11.3(r) cast from pointer to pointer (upcast) -emacro(9087, Q_HSM_UPCAST) // M3-R11.2(req) cast from pointer to pointer involves a pointer to an incomplete type other than void -emacro(9076, QACTIVE_POST, QF_ACTIVE_CAST) // QF-nano ------------------------------------------------------------------- // M3-D4.9(adv) function-like macro -esym(9026, QF_INT_DISABLE, QF_INT_ENABLE, QF_LOG2, Q_ROM, Q_ROM_BYTE, Q_ROM_PTR, QF_ACTIVE_CAST, QF_ROM_QUEUE_AT_, QF_ROM_ACTIVE_GET_, QACTIVE_POST, QACTIVE_POST_X, QACTIVE_POST_ISR, QACTIVE_POST_X_ISR) // M3-R11.3(req) cast from pointer to object type to pointer to different object type -emacro(9087, Q_SIG, Q_PAR, QACTIVE_POST, QACTIVE_POST_ISR) // suspicious pointer-to-pointer conversion (area too small) -emacro(826, QACTIVE_POST, QACTIVE_POST_ISR) // QV-nano ------------------------------------------------------------------- // M3-D4.9(adv) function-like macro -esym(9026, QV_INIT, QV_CPU_SLEEP) // QK-nano ------------------------------------------------------------------- // M3-D4.9(a) function-like macro -esym(9026, QK_INIT, QK_ISR_ENTRY, QK_ISR_EXIT, QK_SCHEDULE_) ================================================ FILE: ports/lint-plus/qpn_conf.h ================================================ /** * @file * @brief QP-nano configuration file. * @description * This header file provides the compile-time configuration of the QP-nano * framework. A version of the `qpn_conf.h` header file needs to be provided * with every QP-nano application. * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-09 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QPN_CONF_H #define QPN_CONF_H /*! The size (in bytes) of the single scalar parameter representation * in the QEvent struct. Valid values: none (0), 1, 2, or 4; default none (0). */ /** * @description * The value of this macro configures the parameter size of QP-nano Events. * If the macro is not defined, the default of no event parameter will * be chosen. The valid Q_PARAM_SIZE values of 1, 2, 4, or 8, correspond * to event parameters of uint8_t, uint16_t, uint32_t, and uint64_t, * respectively. * * @sa ::QEvt, #Q_PAR(), QF_post(), QF_postNoLock() */ #define Q_PARAM_SIZE 4U /*! The size (in bytes) of the time event-counter representation in * the QActive struct. Valid values: none (0), 1, 2, or 4; default none (0). */ /** * @description * The value of this macro configures the internal tick counter size of * QP-nano Time Events. If the macro is not defined, the default of no time * event counter will be chosen. The valid values of 1, 2, or 4, correspond * to tick counters of uint8_t, uint16_t, and uint32_t, respectively. The * tick counter representation determines the dynamic range of time delays * that a Time Event can handle. * * @sa #QTimeEvtCtr */ #define QF_TIMEEVT_CTR_SIZE 2U /*! Configuration switch to enable/disable periodic time events. */ /** * @description * The value of this macro configures the QF-nano timer is capable of firing * periodically or is limited to one-shot only. The reason for not allowing * periodic time events is that they require additional storage (inside * QActive) for the timeout interval.@n * @n * When the macro QF_TIMEEVT_PERIODIC is not defined, the function * QActive_armX() takes 3 arguments: the active object pointer, the tick * rate of the timer, and the one-shot timeout.@n * @n * When the macro QF_TIMEEVT_PERIODIC is not defined, the function * QActive_armX() takes additional 4-th argument: the interval to re-arm * the time event automatically until QActive_disarmX() is called. */ #define QF_TIMEEVT_PERIODIC /*! Configuration switch to enable/disable keeping track of QF time event usage. */ /** * @description * The QF-nano keeps track of the armed time events by means of the timer-sets * (a separate one for each clock tick rate). The main use of the timer-sets * is to quickly determine which time events at a given tick rate are still * armed to enter the most appropriate low-power mode of the MCU. */ #define QF_TIMEEVT_USAGE /*! The preprocessor switch to enable the QK-nano scheduler locking. */ /** * @description * QK-nano keeps supports selective scheduler locking up to a specified * ceiling priority. This scheduler locking can be used, for example, as * a non-blocking mutual exclusion mechanism (formerly QK-nano mutex). */ #define QK_SCHED_LOCK #endif /* QPN_CONF_H */ ================================================ FILE: ports/lint-plus/qvn/qfn_port.h ================================================ /** * @file * @brief QF-nano port for Lint, cooperative QV-nano kernel, generic C compiler * @cond ****************************************************************************** * Last updated for version 6.7.0 * Last updated on 2019-12-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /** * @description * This header file contains the port and customization of QP-nano to * the specific CPU and compiler. Typically, this header file includes * the platform-independent header file qpn.h. */ #define QF_INT_DISABLE() int_disable() #define QF_INT_ENABLE() int_enable() /*! Macro that specifies QV-nano initialization */ /** * @description * Some QV-nano ports might need initialization (e.g., seeting the priorities * of exceptions PendSV and SVCall in ARM Cortex-M port). The QV_INIT() macro * in this case calls the initialization defined in assembly. * * @note The macro QV_INIT() can be left undefined. */ #define QV_INIT() QV_init() void QV_init(void); /*! Macro to put the CPU to sleep safely in the cooperative QV kernel * (inside QV_onIdle()). */ /** * @description * This macro is provided in some QP ports for the QV cooperative kernel * and in general it depends on the interrupt disabling policy. * * @note The provided code is just an example (for ARM Cortex-M). */ #define QV_CPU_SLEEP() do { \ __disable_interrupt(); \ QF_INT_ENABLE(); \ __WFI(); \ __enable_interrupt(); \ } while (false) void int_disable(void); /*!< example of a function to disable interrupts */ void int_enable(void); /*!< example of a function to enable interrupts */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/lint-plus/std.lnt ================================================ /// @file /// @brief PC-Lint-Plus standard option file /// @ingroup lint /// @cond ///=========================================================================== /// Product: QP/C /// Last Updated for Version: 6.7.0 /// Date of the Last Update: 2019-12-10 /// /// Q u a n t u m L e a P s /// ------------------------ /// Modern Embedded Software /// /// Copyright (C) 2005-2019 Quantum Leaps. All rights reserved. /// /// This program is free software: you can redistribute it and/or modify /// it under the terms of the GNU General Public License as published by /// the Free Software Foundation, either version 3 of the License, or /// (at your option) any later version. /// /// Alternatively, this program may be distributed and modified under the /// terms of Quantum Leaps commercial licenses, which expressly supersede /// the GNU General Public License and are specifically designed for /// licensees interested in retaining the proprietary status of their code. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program. If not, see . /// /// Contact information: /// /// ///=========================================================================== /// @endcond // message formatting options... -hF1 // output: a single line +ffn // use full path names //-"format=%(\q%f\q %l %C%) %t %n: %m" //-width(0,0) // do not break lines -width(120,4) // break lines after 99 characters with 4 characters indent +flm // make sure no foreign includes change the format // language standard... -std=c89 -d__STDC_VERSION__=199409L // C89 Standard last ammended 1994-04 //-std=c99 //-d__STDC_VERSION__=199901L // C99 Standard 1999-01 +rw(inline, entry) -zero(99) // don't stop because of warnings -passes(2) // make two passes (for better error messages) -restore_at_end // don't let -e options bleed to other files -summary() // produce a summary of all produced messages // globally supress the following warning: -e546 // explicitly taking address of function -e717 // monocarpic do-while used to group statements ================================================ FILE: ports/lint-plus/stdbool.h ================================================ /** * @file * @brief Boolean type and constansts. WG14/N843 C99 Standard, Section 7.16 * * @description * This header is part of the ANSI C99 standard library to define the * standard Boolean type as well as the 'true' and 'false' constansts. */ #ifndef STDBOOL_H #define STDBOOL_H /*lint -save */ /*lint -e9071 M3-R21.1(r), defined macro is reserved to the compiler */ /*lint -e9093 the name is reserved to the compiler */ /*lint -emacro(506, true) constant value used in Boolean context (operand to ! operator) */ #ifndef __cplusplus typedef _Bool bool; /*!< standard Boolean data type */ /*! standard 'false' constant */ #define false ((bool)0) /*! standard 'true' constant */ #define true ((bool)!false) #endif /* !__cplusplus */ /*lint -restore */ #endif /* STDBOOL_H */ ================================================ FILE: ports/msp430/README.txt ================================================ About The QP-MSP430 Port ======================= This directory contains the QP-nano ports to the MSP430 processor family, for both "classic" MSP430 and "extended" MSP430X cores. The following ports are provided: msp430 | +-qk - port to the preemptive QK kernel | +-ccs - port with the CCS-430 toolset | +-iar - port with the IAR-430 toolset | +-qv - port to the cooperative QV kernel | +-ccs - port with the CCS-430 toolset | +-iar - port with the IAR-430 toolset ================================================ FILE: ports/msp430/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/msp430.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/msp430/qk/ccs/README.txt ================================================ About The QP-MSP430 Port ======================== This directory contains the QP-nano port to the MSP430 processor family with the preemptive QK-nano kernel using the TI CCS-430 compiler. Using the Port in CCS ===================== The recommended CCS project setup procedure is illustrated in the provided CCS example projects in the qpn/examples/msp430/ directory, is to create a folders for QP-nano source. These folders are "qfn" and "qkn". It is important to create the "qfn" and "qkn" folders as "Linked folders", by expanding the "Advanced" folder option and selecting the "Linked to alternate location (Linked Folder)" radio button. The "qfn" folder should be linked to "qpn\src\qfn" The "qkn" folder should be linked to "qpn\src\qkn" Finally, to build QP-nano framework from sources, the following directories should be present in the compiler "Include Options": \include \ports\msp430\qk\ccs Where, is either relative or absolute path to the QP-nano framework folder on your machine. ================================================ FILE: ports/msp430/qk/ccs/qfn_port.h ================================================ /** * @file * @brief QF-nano port to MSP430, preemptive QK-nano kernel, CCS-430 toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QK-nano interrupt entry/exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } while (false) #include /* CCS intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/msp430/qk/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port to MSP430, preemptive QK-nano kernel, IAR-430 toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ /* QK-nano interrupt entry/exit */ #define QK_ISR_ENTRY() ((void)0) #define QK_ISR_EXIT() do { \ if (QK_sched_() != 0U) { \ QK_activate_(); \ } \ } while (false) #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/msp430/qv/ccs/README.txt ================================================ About The QP-MSP430 Port ======================== This directory contains the QP-nano port to the MSP430 processor family with the cooperative QV-nano kernel using the TI CCS-430 compiler. Using the Port in CCS ===================== The recommended CCS project setup procedure is illustrated in the provided CCS example projects in the qpn/examples/msp430/ directory, is to create a folders for QP-nano source. These folders are "qfn" and "qvn". It is important to create the "qfn" and "qvn" folders as "Linked folders", by expanding the "Advanced" folder option and selecting the "Linked to alternate location (Linked Folder)" radio button. The "qfn" folder should be linked to "qpn\src\qfn" The "qvn" folder should be linked to "qpn\src\qvn" Finally, to build QP-nano framework from sources, the following directories should be present in the compiler "Include Options": \include \ports\msp430\qv\ccs Where, is either relative or absolute path to the QP-nano framework folder on your machine. ================================================ FILE: ports/msp430/qv/ccs/qfn_port.h ================================================ /** * @file * @brief QF-nano port to MSP430, cooperative QV-nano kernel, CCS-430 toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ #include /* CCS intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/msp430/qv/iar/qfn_port.h ================================================ /** * @file * @brief QF-nano port to MSP430, cooperative QV-nano kernel, IAR-430 toolset * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable... */ #define QF_INT_DISABLE() __disable_interrupt() #define QF_INT_ENABLE() __enable_interrupt() /* QF-nano interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ #include /* IAR intrinsic functions */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/pic24_dspic/qk/xc16/qfn_port.h ================================================ /** * @file * @brief QF-nano port, PIC24/dsPIC, QK-nano kernel, XC16 compiler * @ingroup ports * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable, see NOTE01 */ #define QF_INT_DISABLE() __builtin_disi(0x3FFFU) #define QF_INT_ENABLE() __builtin_disi(0x0000U) /* ISR-level interrupt locking policy for PIC24/dsPIC, see NOTE02 */ #define QF_ISR_NEST /* QK-nano interrupt entry/exit */ #define QK_ISR(psv_) \ void __attribute__((__interrupt__(__preprologue__( \ "push RCOUNT \n" \ "push.d w0 \n" \ "mov.w [w15-8],w0 \n" \ "lsr.w w0,#13,w1 \n" \ "mov.w #1,w0 \n" \ "sl w0,w1,w0 \n" \ "ior.b _QK_IPL_set_\n" \ "bra .+6 ")) \ , psv_)) #define QK_ISR_EXIT() do { \ register uint16_t this_sr; \ __asm__ volatile ( \ "mov.w SR,%0 \n" \ "lsr %0,#5,w0 \n" \ "and.w w0,#7,w0 \n" \ "mov.w #1,w1 \n" \ "sl w1,w0,w0 \n" \ "ior.b #1,w0 \n" \ "com.b w0,w0 \n" \ "disi #0x3FFF \n" \ "and.b _QK_IPL_set_" : "=r"(this_sr) : : "w0", "w1"); \ if (QK_IPL_set_ == 0U) { \ if (QK_sched_() != 0U) { \ __asm__ volatile ("clr.b SR"); \ QK_activate_(); \ __asm__ volatile ("mov.w %0,SR" : : "r"(this_sr)); \ } \ } \ __asm__ volatile ("disi #0x0000"); \ } while (false); #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qkn.h" /* QK-nano platform-independent public interface */ /* set of active interrupt priority levels (IPLs) */ extern uint8_t volatile QK_IPL_set_; /***************************************************************************** * NOTE01: * The DISI (disable interrupts) instruction is used for very fast, * unconditional locking and unlocking of interrupts. The DISI #0x3FFF * instruction disables interrupts for 16383 instruction cycles, which is * much longer than any critical section in QP-nano. The DISI #0 instruction * is then used to unconditionally unlock the interrupts at the end of the * critical section. The DISI instruction only disables interrupts with * priority levels 1-6. Priority level 7 interrupts and all trap events still * have the ability to interrupt the CPU when the DISI instruction is active. * This means that from the perspective of QP-nano, the level 7 interrupts are * treated as non-maskable interrupts (NMIs). Such non-maskable interrupts * _cannot_ call any QP-nano services. In particular, they cannot post events. * * CAUTION: This QP-nano port assumes that interrupt nesting is _enabled_, * which is the default in the PIC24/dsPIC processors. Interrupt nesting should * never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you * don't want interrupts to nest, you can always prioritize them at the same * level. For example, the default priority level for all interrupts is 4 out * of reset. If you don't change this level for any interrupt the nesting of * interrupt will not occur. * * NOTE02: * The ISR-level interrupt policy allows interrupt nesting. The QF_ISR_KEY_TYPE * is _not_ defined, which means that the ISRs will use the task-level * interrupt locking policy. This is possible, because PIC24/dsPIC CPU does * _not_ lock interrupts upon entry to the ISR, so the ISR does not constitute * critical section and the simple critical section incapable of nesting is * adequate. * * CAUTION: This _preemptive_ QK-nano port requires writing ISRs in assembly, * as shown in the file isr.s. Unfortunately, the ISRs that the C30 compiler * is capable of generating are not adequate for the QK-nano kernel. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/pic24_dspic/qk/xc16/qkn_port.c ================================================ /** * @file * @brief QK-nano port, PIC24/dsPIC, QK kernel, MPLABX-XC16 compiler * @ingroup ports * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qfn_port.h" /* set of active interrupt priority levels (IPLs) */ uint8_t volatile QK_IPL_set_; ================================================ FILE: ports/pic24_dspic/qv/xc16/qfn_port.h ================================================ /** * @file * @brief QF-nano port, PIC24/dsPIC, cooperative QV-nano kernel, XC16 compiler * @ingroup ports * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* QF-nano interrupt disable/enable, see NOTE01 */ #define QF_INT_DISABLE() __builtin_disi(0x3FFFU) #define QF_INT_ENABLE() __builtin_disi(0x0000U) /* ISR-level interrupt locking policy for PIC24/dsPIC, see NOTE02 */ #define QF_ISR_NEST #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano platform-independent public interface */ /***************************************************************************** * NOTE01: * The DISI (disable interrupts) instruction is used for very fast, * unconditional locking and unlocking of interrupts. The DISI #0x3FFF * instruction disables interrupts for 16383 instruction cycles, which is * much longer than any critical section in QP-nano. The DISI #0 instruction * is then used to unconditionally unlock the interrupts at the end of the * critical section. The DISI instruction only disables interrupts with * priority levels 1-6. Priority level 7 interrupts and all trap events still * have the ability to interrupt the CPU when the DISI instruction is active. * This means that from the perspective of QP-nano, the level 7 interrupts are * treated as non-maskable interrupts (NMIs). Such non-maskable interrupts * _cannot_ call any QP-nano services. In particular, they cannot post events. * * CAUTION: This QP-nano port assumes that interrupt nesting is _enabled_, * which is the default in the PIC24/dsPIC processors. Interrupt nesting should * never be disabled by setting the NSTDIS control bit (INTCON1<15>). If you * don't want interrupts to nest, you can always prioritize them at the same * level. For example, the default priority level for all interrupts is 4 out * of reset. If you don't change this level for any interrupt the nesting of * interrupt will not occur. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/posix-qv/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/posix-qv.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/posix-qv/qfn_port.h ================================================ /** * @file * @brief QF-nano emulation for POSIX with cooperative QV kernel * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* interrupt disabling policy for task level, see NOTE1 */ #define QF_INT_DISABLE() QF_enterCriticalSection_() #define QF_INT_ENABLE() QF_leaveCriticalSection_() /* interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel public interface */ /* QF functions specific to the port */ void QF_enterCriticalSection_(void); void QF_leaveCriticalSection_(void); /* set clock tick rate and p-thread priority * (NOTE ticksPerSec==0 disables the "ticker thread" */ void QF_setTickRate(uint32_t ticksPerSec, int_t tickPrio); /* ISR-level clock tick callback * (NOTE not called when "ticker thread" is not running) */ void QF_onClockTickISR(void); /* application-level callback to cleanup the application */ void QF_onCleanup(void); /* abstractions for console access... */ void QF_consoleSetup(void); void QF_consoleCleanup(void); int QF_consoleGetKey(void); int QF_consoleWaitForKey(void); /* NOTES: ******************************************************************** * * NOTE1: * QF-nano, like all small real-time kernels, needs to disable and enable * interrupts to execute critical sections of code atomically. However, * POSIX does not really allow disabling/enabling interrutps at the task * level. Instead, this QF-nano emulation uses therefore a single package-scope * p-thread mutex QF_pThreadMutex_ to protect all critical sections. The mutex * is locked upon the entry to each critical sectioni and unlocked upon exit. * * Using the single mutex for all crtical section guarantees that only one * thread at a time can execute inside a critical section. This prevents race * conditions and data corruption. * * Note, however, that the mutex implementation of a critical section behaves * differently than the standard interrupt locking. For example, the mutex * approach might be subject to priority inversions. However, most p-thread * mutex implementations, such as Linux p-threads, should support the * priority-inheritance protocol. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/posix-qv/qfn_posix.c ================================================ /** * @file * @brief QF-nano port to POSIX API with cooperative QV scheduler (posix-qv) * @ingroup ports * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-17 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ /* expose features from the 2008 POSIX standard (IEEE Standard 1003.1-2008) */ #define _POSIX_C_SOURCE 200809L #include "qpn.h" /* QP-nano */ #include #include #include #include #include #include #include #ifdef qkn_h #error "This QP-nano port does not support QK-nano configuration" #endif Q_DEFINE_THIS_MODULE("qfn_posix") /* Global objects ==========================================================*/ uint_fast8_t volatile QF_readySet_; /* ready-set of QF-nano */ uint_fast8_t QF_maxActive_; /* # active objects that QF-nano must manage */ #ifdef QF_TIMEEVT_USAGE uint_fast8_t volatile QF_timerSetX_[QF_MAX_TICK_RATE]; /* timer-set */ #endif #ifndef QF_LOG2 uint8_t const Q_ROM QF_log2Lkup[16] = { 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U }; #endif /* QF_LOG2 */ /* Local objects ===========================================================*/ /* mutex for QF critical section */ static pthread_mutex_t l_pThreadMutex_; static pthread_cond_t l_condVar; /* cond var to signal when AOs are ready */ static struct termios l_tsav; /* structure with saved terminal attributes */ static bool l_isRunning; /* flag indicating when QF is running */ static struct timespec l_tick; static int_t l_tickPrio; enum { NANOSLEEP_NSEC_PER_SEC = 1000000000 }; /* see NOTE1 */ /* "fudged" event queues for AOs, see NOTE2 */ #define QF_FUDGED_QUEUE_LEN 0xFFU static QEvt l_fudgedQueue[8][QF_FUDGED_QUEUE_LEN]; #define QF_FUDGED_QUEUE_AT_(ao_, i_) (l_fudgedQueue[(ao_)->prio - 1U][(i_)]) static void *tickerThread(void *par); /* the expected P-Thread signature */ static void sigIntHandler(int dummy); /****************************************************************************/ void QActive_ctor(QActive * const me, QStateHandler initial) { static QActiveVtable const vtable = { /* QActive virtual table */ { &QHsm_init_, &QHsm_dispatch_ }, &QActive_postX_, &QActive_postXISR_ }; QHsm_ctor(&me->super, initial); me->super.vptr = &vtable.super; /* hook the vptr to QActive vtable */ } /****************************************************************************/ #if (Q_PARAM_SIZE != 0) bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { QF_INT_DISABLE(); bool status; if (margin == QF_NO_MARGIN) { if (QF_FUDGED_QUEUE_LEN > me->nUsed) { status = true; /* can post */ } else { status = false; /* cannot post */ Q_ERROR_ID(310); /* must be able to post the event */ } } else if ((QF_FUDGED_QUEUE_LEN - me->nUsed) > margin) { status = true; /* can post */ } else { status = false; /* cannot post */ } if (status) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_FUDGED_QUEUE_AT_(me, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0) QF_FUDGED_QUEUE_AT_(me, me->head).par = par; #endif if (me->head == 0U) { me->head = QF_FUDGED_QUEUE_LEN; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the corresponding bit in the ready set */ QF_readySet_ |= (uint_fast8_t)(1U << (me->prio - 1U)); pthread_cond_signal(&l_condVar); /* unblock the event loop */ } } QF_INT_ENABLE(); return status; } /****************************************************************************/ #if (Q_PARAM_SIZE != 0) bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { bool status; if (margin == QF_NO_MARGIN) { if (QF_FUDGED_QUEUE_LEN > me->nUsed) { status = true; /* can post */ } else { status = false; /* cannot post */ Q_ERROR_ID(310); /* must be able to post the event */ } } else if ((QF_FUDGED_QUEUE_LEN - me->nUsed) > margin) { status = true; /* can post */ } else { status = false; /* cannot post */ } if (status) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_FUDGED_QUEUE_AT_(me, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0) QF_FUDGED_QUEUE_AT_(me, me->head).par = par; #endif if (me->head == 0U) { me->head = QF_FUDGED_QUEUE_LEN; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the bit */ QF_readySet_ |= (uint_fast8_t)(1U << (me->prio - 1U)); pthread_cond_signal(&l_condVar); /* unblock the event loop */ } } return status; } /****************************************************************************/ #if (QF_TIMEEVT_CTR_SIZE != 0) void QF_tickXISR(uint_fast8_t const tickRate) { uint_fast8_t p = QF_maxActive_; do { QActive *a = QF_ROM_ACTIVE_GET_(p); QTimer *t = &a->tickCtr[tickRate]; if (t->nTicks != 0U) { --t->nTicks; if (t->nTicks == 0U) { #ifdef QF_TIMEEVT_PERIODIC if (t->interval != 0U) { t->nTicks = t->interval; /* re-arm the periodic timer */ } #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (p - 1U))); #endif /* QF_TIMEEVT_USAGE */ #if (Q_PARAM_SIZE != 0) QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate, 0U); #else QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate); #endif /* (Q_PARAM_SIZE != 0) */ } } --p; } while (p != 0U); } /****************************************************************************/ #ifdef QF_TIMEEVT_PERIODIC void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval) #else void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks) #endif { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = nTicks; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = interval; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* set a bit in QF_timerSetX_[] to rememer that the timer is running */ QF_timerSetX_[tickRate] |= (uint_fast8_t)(1U << (me->prio - 1U)); #endif QF_INT_ENABLE(); } /****************************************************************************/ void QActive_disarmX(QActive * const me, uint_fast8_t const tickRate) { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = 0U; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* clear a bit in QF_timerSetX_[] to rememer that timer is not running */ QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (me->prio - 1U))); #endif QF_INT_ENABLE(); } #endif /* #if (QF_TIMEEVT_CTR_SIZE != 0) */ /* QF functions ============================================================*/ void QF_enterCriticalSection_(void) { pthread_mutex_lock(&l_pThreadMutex_); } /****************************************************************************/ void QF_leaveCriticalSection_(void) { pthread_mutex_unlock(&l_pThreadMutex_); } /****************************************************************************/ /** * @description * The function QF_init() initializes the number of active objects to be * managed by the framework and clears the internal QF-nano variables as well * as all registered active objects to zero, which is needed in case when * the startup code does not clear the uninitialized data (in violation of * the C Standard). * * @note * The intended use of the function is to call as follows: * QF_init(Q_DIM(QF_active)); */ void QF_init(uint_fast8_t maxActive) { QActive *a; uint_fast8_t p; struct sigaction sig_act; #if (defined(QF_TIMEEVT_USAGE) || (QF_TIMEEVT_CTR_SIZE != 0)) uint_fast8_t n; #endif /* QF_TIMEEVT_USAGE */ /** @pre the number of active objects must be in range */ Q_REQUIRE_ID(100, (1U < maxActive) && (maxActive <= 9U)); QF_maxActive_ = maxActive - 1U; /* init the global mutex with the default non-recursive initializer */ pthread_mutex_init(&l_pThreadMutex_, NULL); l_tick.tv_sec = 0; l_tick.tv_nsec = NANOSLEEP_NSEC_PER_SEC/100L; /* default clock tick */ l_tickPrio = sched_get_priority_min(SCHED_FIFO); /* default tick prio */ /* install the SIGINT (Ctrl-C) signal handler */ sig_act.sa_handler = &sigIntHandler; sigaction(SIGINT, &sig_act, NULL); #ifdef QF_TIMEEVT_USAGE for (n = 0U; n < QF_MAX_TICK_RATE; ++n) { QF_timerSetX_[n] = 0U; } #endif /* QF_TIMEEVT_USAGE */ QF_readySet_ = 0U; #ifdef QK_PREEMPTIVE QK_currPrio_ = 8U; /* QK-nano scheduler locked */ #ifdef QF_ISR_NEST QK_intNest_ = 0U; #endif #ifdef QK_SCHED_LOCK QK_lockPrio_ = 0U; #endif #endif /* #ifdef QK_PREEMPTIVE */ /* clear all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(110, a != (QActive *)0); a->head = 0U; a->tail = 0U; a->nUsed = 0U; #if (QF_TIMEEVT_CTR_SIZE != 0) for (n = 0U; n < QF_MAX_TICK_RATE; ++n) { a->tickCtr[n].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC a->tickCtr[n].interval = 0U; #endif /* def QF_TIMEEVT_PERIODIC */ } #endif /* (QF_TIMEEVT_CTR_SIZE != 0) */ } } /****************************************************************************/ int_t QF_run(void) { uint_fast8_t p; QActive *a; pthread_t thread; struct sched_param sparam; pthread_cond_init(&l_condVar, 0); /* set priorities all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(810, a != (QActive *)0); a->prio = p; /* set the priority of the active object */ } /* trigger initial transitions in all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); QHSM_INIT(&a->super); /* take the initial transition in the HSM */ } QF_onStartup(); /* invoke startup callback */ /* try to set the priority of the ticker thread, see NOTE01 */ sparam.sched_priority = l_tickPrio; if (pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam) == 0) { /* success, this application has sufficient privileges */ } else { /* setting priority failed, probably due to insufficient privieges */ } l_isRunning = true; /* system clock tick configured? */ if ((l_tick.tv_sec != 0) || (l_tick.tv_nsec != 0)) { Q_ALLEGE_ID(810, pthread_create(&thread, (pthread_attr_t *)0, &tickerThread, (void *)0) == 0); /* ticker thread must be created */ } /* the event loop of the QV-nano kernel... */ QF_INT_DISABLE(); while (l_isRunning) { if (QF_readySet_ != 0U) { /* hi nibble non-zero? */ if ((QF_readySet_ & 0xF0U) != 0U) { p = (uint_fast8_t)( Q_ROM_BYTE(QF_log2Lkup[QF_readySet_ >> 4]) + 4U); } else { /* hi nibble of QF_readySet_ is zero */ p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_]); } a = QF_ROM_ACTIVE_GET_(p); /* some unsuded events must be available */ Q_ASSERT_ID(820, a->nUsed > 0U); --a->nUsed; Q_SIG(a) = QF_FUDGED_QUEUE_AT_(a, a->tail).sig; #if (Q_PARAM_SIZE != 0) Q_PAR(a) = QF_FUDGED_QUEUE_AT_(a, a->tail).par; #endif if (a->tail == 0U) { /* wrap around? */ a->tail = QF_FUDGED_QUEUE_LEN; } --a->tail; QF_INT_ENABLE(); QHSM_DISPATCH(&a->super); /* dispatch to the HSM (RTC step) */ QF_INT_DISABLE(); /* empty queue? */ if (a->nUsed == 0U) { /* clear the bit corresponding to 'p' */ QF_readySet_ &= (uint_fast8_t)(~(1U << (p - 1U))); } } else { /* the QV kernel in embedded systems calls here the QV_onIdle() * callback. However, the POSIX-QV port does not do busy-waiting * for events. Instead, the POSIX-QV port efficiently waits until * QP events become available. */ while (QF_readySet_ == 0U) { pthread_cond_wait(&l_condVar, &l_pThreadMutex_); } } } QF_INT_ENABLE(); QF_onCleanup(); /* cleanup callback */ pthread_cond_destroy(&l_condVar); /* cleanup the condition variable */ pthread_mutex_destroy(&l_pThreadMutex_); return 0; /* success */ } /*..........................................................................*/ void QF_stop(void) { l_isRunning = false; /* cause exit from the event loop */ /* unblock the event loop so it can terminate */ QF_readySet_ = 1U; pthread_cond_signal(&l_condVar); } /****************************************************************************/ void QF_setTickRate(uint32_t ticksPerSec, int_t tickPrio) { if (ticksPerSec != 0U) { l_tick.tv_nsec = NANOSLEEP_NSEC_PER_SEC / ticksPerSec; } else { l_tick.tv_nsec = 0; /* means NO system clock tick */ } l_tickPrio = tickPrio; } /*..........................................................................*/ void QF_consoleSetup(void) { struct termios tio; /* modified terminal attributes */ tcgetattr(0, &l_tsav); /* save the current terminal attributes */ tcgetattr(0, &tio); /* obtain the current terminal attributes */ tio.c_lflag &= ~(ICANON | ECHO); /* disable the canonical mode & echo */ tcsetattr(0, TCSANOW, &tio); /* set the new attributes */ } /*..........................................................................*/ void QF_consoleCleanup(void) { tcsetattr(0, TCSANOW, &l_tsav); /* restore the saved attributes */ } /*..........................................................................*/ int QF_consoleGetKey(void) { int byteswaiting; ioctl(0, FIONREAD, &byteswaiting); if (byteswaiting > 0) { char ch; read(0, &ch, 1); return (int)ch; } return 0; /* no input at this time */ } /*..........................................................................*/ int QF_consoleWaitForKey(void) { return getchar(); } /*..........................................................................*/ static void *tickerThread(void *par) { /* the expected P-Thread signature */ (void)par; /* unused parameter */ while (l_isRunning) { nanosleep(&l_tick, NULL); /* sleep for the number of ticks, NOTE1 */ QF_INT_DISABLE(); /* make sure simulated ISR cannot be preempted */ QF_onClockTickISR(); /* call back to the app, see NOTE3 */ QF_INT_ENABLE(); } return (void *)0; /* return success */ } /****************************************************************************/ static void sigIntHandler(int dummy) { (void)dummy; /* unused parameter */ QF_onCleanup(); exit(-1); } /* NOTES: ******************************************************************** * * NOTE1: * In some (older) Linux kernels, the POSIX nanosleep() system call might * deliver only 2*actual-system-tick granularity. To compensate for this, * you would need to reduce (by 2) the constant NANOSLEEP_NSEC_PER_SEC. * * NOTE2: * POSIX is not necessariliy a deterministic real-time system, which means * that the system can occasionally and unexpectedly "choke and freeze" for * a number of seconds. The designers of POSIX have dealt with these sort * of issues by massively oversizing the resources available to the * applications. For example, the the stacks of POSIX-threads can dynamically * grow to several megabytes. * * In contrast, the event queues, event pools, and stack size inside the * real-time embedded (RTE) systems can be (and must be) much smaller, * because you typically can put an upper bound on the real-time behavior * and the resulting delays. * * To be able to run the unmodified applications designed originally for * RTE systems on POSIX, and to reduce the odds of resource shortages in * this case, the event queues of all Active Objects are "fudged" to the * maximum dynamic range of uint_fast8_t data type, which is 0xFF * (see QF_FUDGED_QUEUE_LEN). * * NOTE3: * The callback QF_onClockTickISR() is invoked with interupts disabled * to emulate the ISR level. This means that only the ISR-level APIs are * available inside the QF_onClockTickISR() callback. */ ================================================ FILE: ports/posix-qv/safe_std.h ================================================ /** * @file * @brief "safe" and facilities * @ingroup qpspy * @cond ****************************************************************************** * Last updated for version 6.8.1 * Last updated on 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef SAFE_STD_H #define SAFE_STD_H #include #include /* portable "safe" facilities from and ................*/ #ifdef _WIN32 /* Windows OS? */ #define MEMMOVE_S(dest_, num_, src_, count_) \ memmove_s(dest_, num_, src_, count_) #define STRCPY_S(dest_, destsiz_, src_) \ strcpy_s(dest_, destsiz_, src_) #define STRCAT_S(dest_, destsiz_, src_) \ strcat_s(dest_, destsiz_, src_) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ _snprintf_s(buf_, bufsiz_, _TRUNCATE, format_, ##__VA_ARGS__) #define PRINTF_S(format_, ...) \ printf_s(format_, ##__VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ fprintf_s(fp_, format_, ##__VA_ARGS__) #ifdef _MSC_VER #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread_s(buf_, bufsiz_, elsiz_, count_, fp_) #else #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread(buf_, elsiz_, count_, fp_) #endif /* _MSC_VER */ #define FOPEN_S(fp_, fName_, mode_) \ if (fopen_s(&fp_, fName_, mode_) != 0) { \ fp_ = (FILE *)0; \ } else (void)0 #define LOCALTIME_S(tm_, time_) \ localtime_s(tm_, time_) #else /* other OS (Linux, MacOS, etc.) .....................................*/ #define MEMMOVE_S(dest_, num_, src_, count_) \ memmove(dest_, src_, count_) #define STRCPY_S(dest_, destsiz_, src_) \ strcpy(dest_, src_) #define STRCAT_S(dest_, destsiz_, src_) \ strcat(dest_, src) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ snprintf(buf_, bufsiz_, format_, ##__VA_ARGS__) #define PRINTF_S(format_, ...) \ printf(format_, ##__VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ fprintf(fp_, format_, ##__VA_ARGS__) #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread(buf_, elsiz_, count_, fp_) #define FOPEN_S(fp_, fName_, mode_) \ (fp_ = fopen(fName_, mode_)) #define LOCALTIME_S(tm_, time_) \ memcpy(tm_, localtime(time_), sizeof(struct tm)) #endif /* _WIN32 */ #endif /* SAFE_STD_H */ ================================================ FILE: ports/win32-qv/README.url ================================================ [InternetShortcut] URL=http://www.state-machine.com/qpn/win32-qv.html IconFile=http://www.state-machine.com/qp.ico ================================================ FILE: ports/win32-qv/qfn_port.h ================================================ /** * @file * @brief QF-nano emulation for Win32 with cooperative QV kernel * @ingroup ports * @cond ****************************************************************************** * Last Updated for Version: 6.8.0 * Date of the Last Update: 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QFN_PORT_H #define QFN_PORT_H /* interrupt disabling policy for task level, see NOTE1 */ #define QF_INT_DISABLE() QF_enterCriticalSection_() #define QF_INT_ENABLE() QF_leaveCriticalSection_() /* interrupt disabling policy for interrupt level */ /*#define QF_ISR_NEST*/ /* nesting of ISRs not allowed */ #include /* Exact-width types. WG14/N843 C99 Standard */ #include /* Boolean type. WG14/N843 C99 Standard */ #include "qepn.h" /* QEP-nano platform-independent public interface */ #include "qfn.h" /* QF-nano platform-independent public interface */ #include "qvn.h" /* QV-nano cooperative kernel public interface */ /* QF functions specific to the port */ void QF_enterCriticalSection_(void); void QF_leaveCriticalSection_(void); /* set clock tick rate (NOTE ticksPerSec==0 disables the "ticker thread") */ void QF_setTickRate(uint32_t ticksPerSec, int_t tickPrio); /* ISR-level clock tick callback * (NOTE not called when "ticker thread" is not running) */ void QF_onClockTickISR(void); /* application-level callback to cleanup the application */ void QF_onCleanup(void); /* special adaptations for QWIN GUI applications... */ #ifdef QWIN_GUI /* replace main() with main_gui() as the entry point to a GUI app. */ #define main() main_gui() int_t main_gui(); /* prototype of the GUI application entry point */ #endif /* abstractions for console access... */ void QF_consoleSetup(void); void QF_consoleCleanup(void); int QF_consoleGetKey(void); int QF_consoleWaitForKey(void); /* NOTES: ******************************************************************** * * NOTE1: * QF-nano, like all real-time kernels, needs to execute certain sections of * code indivisibly to avoid data corruption. The most straightforward way of * protecting such critical sections of code is disabling and enabling * interrupts, which Win32 does not allow. * * This QF-nano port uses internally a single Win32 critical section object * (Win32 type CRITICAL_SECTION) to protect all critical sections. * * Using the single critical section object for all crtical section guarantees * that only one thread at a time can execute inside a critical section. This * prevents race conditions and data corruption. * * Please note, however, that the Win32 critical section implementation * behaves differently than interrupt disabling. For example, the Win32 * critical section can potentially be subject to priority inversions. Various * versions of Windows handle priority inversions differently, but it seems * that most of them recognize priority inversions and dynamically adjust the * priorities of threads to prevent it. Please refer to the MSN articles for * more information. */ #endif /* QFN_PORT_H */ ================================================ FILE: ports/win32-qv/qfn_win32.c ================================================ /** * @file * @brief QF-nano port to Win32 API (single-threaded, like the QV kernel) * @ingroup ports * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-17 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn.h" /* QP-nano */ #define WIN32_LEAN_AND_MEAN #include /* Win32 API */ #include /* console input/output */ #ifdef qkn_h #error "This QP-nano port does not support QK-nano configuration" #endif Q_DEFINE_THIS_MODULE("qfn_win32") /* Global objects ==========================================================*/ uint_fast8_t volatile QF_readySet_; /* ready-set of QF-nano */ uint_fast8_t QF_maxActive_; /* # active objects that QF-nano must manage */ #ifdef QF_TIMEEVT_USAGE uint_fast8_t volatile QF_timerSetX_[QF_MAX_TICK_RATE]; /* timer-set */ #endif #ifndef QF_LOG2 uint8_t const Q_ROM QF_log2Lkup[16] = { 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U }; #endif /* QF_LOG2 */ /* Local objects ===========================================================*/ static CRITICAL_SECTION l_win32CritSect; /* for QP-nano critical sections */ static HANDLE l_win32Event; /* Win32 event to signal events */ static DWORD l_tickMsec = 10U; /* clock tick in msec (argument for Sleep()) */ static int_t l_tickPrio = 50; /* default priority of the "ticker" thread */ static bool l_isRunning; /* flag indicating when QF is running */ /* "fudged" event queues for AOs, see NOTE1 */ #define QF_FUDGED_QUEUE_LEN 0xFFU static QEvt l_fudgedQueue[8][QF_FUDGED_QUEUE_LEN]; #define QF_FUDGED_QUEUE_AT_(ao_, i_) (l_fudgedQueue[(ao_)->prio - 1U][(i_)]) static DWORD WINAPI ticker_thread(LPVOID arg); /****************************************************************************/ void QActive_ctor(QActive * const me, QStateHandler initial) { static QActiveVtable const vtable = { /* QActive virtual table */ { &QHsm_init_, &QHsm_dispatch_ }, &QActive_postX_, &QActive_postXISR_ }; QHsm_ctor(&me->super, initial); me->super.vptr = &vtable.super; /* hook the vptr to QActive vtable */ } /****************************************************************************/ #if (Q_PARAM_SIZE != 0) bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { QF_INT_DISABLE(); bool status; if (margin == QF_NO_MARGIN) { if (QF_FUDGED_QUEUE_LEN > me->nUsed) { status = true; /* can post */ } else { status = false; /* cannot post */ Q_ERROR_ID(310); /* must be able to post the event */ } } else if ((QF_FUDGED_QUEUE_LEN - me->nUsed) > margin) { status = true; /* can post */ } else { status = false; /* cannot post */ } if (status) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_FUDGED_QUEUE_AT_(me, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0) QF_FUDGED_QUEUE_AT_(me, me->head).par = par; #endif if (me->head == 0U) { me->head = QF_FUDGED_QUEUE_LEN; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the corresponding bit in the ready set */ QF_readySet_ |= (uint_fast8_t)(1U << (me->prio - 1U)); SetEvent(l_win32Event); } } QF_INT_ENABLE(); return status; } /****************************************************************************/ #if (Q_PARAM_SIZE != 0) bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { bool status; if (margin == QF_NO_MARGIN) { if (QF_FUDGED_QUEUE_LEN > me->nUsed) { status = true; /* can post */ } else { status = false; /* cannot post */ Q_ERROR_ID(310); /* must be able to post the event */ } } else if ((QF_FUDGED_QUEUE_LEN - me->nUsed) > margin) { status = true; /* can post */ } else { status = false; /* cannot post */ } if (status) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_FUDGED_QUEUE_AT_(me, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0) QF_FUDGED_QUEUE_AT_(me, me->head).par = par; #endif if (me->head == 0U) { me->head = QF_FUDGED_QUEUE_LEN; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the bit */ QF_readySet_ |= (uint_fast8_t)(1U << (me->prio - 1U)); SetEvent(l_win32Event); } } return status; } /****************************************************************************/ #if (QF_TIMEEVT_CTR_SIZE != 0) void QF_tickXISR(uint_fast8_t const tickRate) { uint_fast8_t p = QF_maxActive_; do { QActive *a = QF_ROM_ACTIVE_GET_(p); QTimer *t = &a->tickCtr[tickRate]; if (t->nTicks != 0U) { --t->nTicks; if (t->nTicks == 0U) { #ifdef QF_TIMEEVT_PERIODIC if (t->interval != 0U) { t->nTicks = t->interval; /* re-arm the periodic timer */ } #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (p - 1U))); #endif /* QF_TIMEEVT_USAGE */ #if (Q_PARAM_SIZE != 0) QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate, 0U); #else QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate); #endif /* (Q_PARAM_SIZE != 0) */ } } --p; } while (p != 0U); } /****************************************************************************/ #ifdef QF_TIMEEVT_PERIODIC void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval) #else void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks) #endif { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = nTicks; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = interval; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* set a bit in QF_timerSetX_[] to rememer that the timer is running */ QF_timerSetX_[tickRate] |= (uint_fast8_t)(1U << (me->prio - 1U)); #endif QF_INT_ENABLE(); } /****************************************************************************/ void QActive_disarmX(QActive * const me, uint_fast8_t const tickRate) { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = 0U; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* clear a bit in QF_timerSetX_[] to rememer that timer is not running */ QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (me->prio - 1U))); #endif QF_INT_ENABLE(); } #endif /* #if (QF_TIMEEVT_CTR_SIZE != 0) */ /* QF functions ============================================================*/ void QF_enterCriticalSection_(void) { EnterCriticalSection(&l_win32CritSect); } /****************************************************************************/ void QF_leaveCriticalSection_(void) { LeaveCriticalSection(&l_win32CritSect); } /****************************************************************************/ /** * @description * The function QF_init() initializes the number of active objects to be * managed by the framework and clears the internal QF-nano variables as well * as all registered active objects to zero, which is needed in case when * the startup code does not clear the uninitialized data (in violation of * the C Standard). * * @note * The intended use of the function is to call as follows: * QF_init(Q_DIM(QF_active)); */ void QF_init(uint_fast8_t maxActive) { QActive *a; uint_fast8_t p; #if (defined(QF_TIMEEVT_USAGE) || (QF_TIMEEVT_CTR_SIZE != 0)) uint_fast8_t n; #endif /* QF_TIMEEVT_USAGE */ /** @pre the number of active objects must be in range */ Q_REQUIRE_ID(100, (1U < maxActive) && (maxActive <= 9U)); QF_maxActive_ = maxActive - 1U; #ifdef QF_TIMEEVT_USAGE for (n = 0U; n < QF_MAX_TICK_RATE; ++n) { QF_timerSetX_[n] = 0U; } #endif /* QF_TIMEEVT_USAGE */ QF_readySet_ = 0U; #ifdef QK_PREEMPTIVE QK_currPrio_ = 8U; /* QK-nano scheduler locked */ #ifdef QF_ISR_NEST QK_intNest_ = 0U; #endif #ifdef QK_SCHED_LOCK QK_lockPrio_ = 0U; #endif #endif /* #ifdef QK_PREEMPTIVE */ /* clear all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(110, a != (QActive *)0); a->head = 0U; a->tail = 0U; a->nUsed = 0U; #if (QF_TIMEEVT_CTR_SIZE != 0) for (n = 0U; n < QF_MAX_TICK_RATE; ++n) { a->tickCtr[n].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC a->tickCtr[n].interval = 0U; #endif /* def QF_TIMEEVT_PERIODIC */ } #endif /* (QF_TIMEEVT_CTR_SIZE != 0) */ } } /****************************************************************************/ int_t QF_run(void) { uint_fast8_t p; QActive *a; InitializeCriticalSection(&l_win32CritSect); l_win32Event = CreateEvent(NULL, FALSE, FALSE, NULL); /* set priorities all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(810, a != (QActive *)0); a->prio = p; /* set the priority of the active object */ } /* trigger initial transitions in all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); QHSM_INIT(&a->super); /* take the initial transition in the HSM */ } QF_onStartup(); /* invoke startup callback */ l_isRunning = true; /* QF-nano is running */ /* system clock tick configured? */ if (l_tickMsec != 0U) { /* create the ticker thread... */ HANDLE ticker = CreateThread(NULL, 1024, &ticker_thread, 0, 0, NULL); Q_ASSERT_ID(810, ticker != (HANDLE)0); /* thread must be created */ } /* the event loop of the QV-nano kernel... */ QF_INT_DISABLE(); while (l_isRunning) { if (QF_readySet_ != 0U) { /* hi nibble non-zero? */ if ((QF_readySet_ & 0xF0U) != 0U) { p = (uint_fast8_t)( Q_ROM_BYTE(QF_log2Lkup[QF_readySet_ >> 4]) + 4U); } else { /* hi nibble of QF_readySet_ is zero */ p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_]); } a = QF_ROM_ACTIVE_GET_(p); /* some unsuded events must be available */ Q_ASSERT_ID(820, a->nUsed > 0U); --a->nUsed; Q_SIG(a) = QF_FUDGED_QUEUE_AT_(a, a->tail).sig; #if (Q_PARAM_SIZE != 0) Q_PAR(a) = QF_FUDGED_QUEUE_AT_(a, a->tail).par; #endif if (a->tail == 0U) { /* wrap around? */ a->tail = QF_FUDGED_QUEUE_LEN; } --a->tail; QF_INT_ENABLE(); QHSM_DISPATCH(&a->super); /* dispatch to the HSM (RTC step) */ QF_INT_DISABLE(); /* empty queue? */ if (a->nUsed == 0U) { /* clear the bit corresponding to 'p' */ QF_readySet_ &= (uint_fast8_t)(~(1U << (p - 1U))); } } else { QF_INT_ENABLE(); /* yield the CPU until new event(s) arrive */ WaitForSingleObject(l_win32Event, (DWORD)INFINITE); QF_INT_DISABLE(); } } QF_INT_ENABLE(); QF_onCleanup(); /* cleanup callback */ /*CloseHandle(l_win32Event);*/ /*DeleteCriticalSection(&l_win32CritSect);*/ return 0; /* success */ } /****************************************************************************/ void QF_stop(void) { l_isRunning = false; /* cause exit from the event loop */ SetEvent(l_win32Event); /* unblock the event-loop so it can terminate */ } /****************************************************************************/ void QF_setTickRate(uint32_t ticksPerSec, int_t tickPrio) { if (ticksPerSec != 0U) { l_tickMsec = 1000UL / ticksPerSec; } else { l_tickMsec = 0U; /* means NO system clock tick */ } l_tickPrio = tickPrio; } /*..........................................................................*/ void QF_consoleSetup(void) { } /*..........................................................................*/ void QF_consoleCleanup(void) { } /*..........................................................................*/ int QF_consoleGetKey(void) { if (_kbhit()) { /* any key pressed? */ return _getch(); } return 0; } /*..........................................................................*/ int QF_consoleWaitForKey(void) { return _getch(); } /****************************************************************************/ static DWORD WINAPI ticker_thread(LPVOID arg) { /* for CreateThread() */ int threadPrio = THREAD_PRIORITY_NORMAL; /* set the ticker thread priority according to selection made in * QF_setTickRate() */ if (l_tickPrio < 33) { threadPrio = THREAD_PRIORITY_BELOW_NORMAL; } else if (l_tickPrio > 66) { threadPrio = THREAD_PRIORITY_ABOVE_NORMAL; } SetThreadPriority(GetCurrentThread(), threadPrio); (void)arg; /* unused parameter */ while (l_isRunning) { Sleep(l_tickMsec); /* wait for the tick interval */ QF_INT_DISABLE(); /* make sure simulated ISR cannot be preempted */ QF_onClockTickISR(); /* call back to the app, see NOTE2 */ QF_INT_ENABLE(); } return 0U; /* return success */ } /***************************************************************************** * NOTE1: * Windows is not a deterministic real-time system, which means that the * system can occasionally and unexpectedly "choke and freeze" for a number * of seconds. The designers of Windows have dealt with these sort of issues * by massively oversizing the resources available to the applications. For * example, the default Windows GUI message queues size is 10,000 entries, * which can dynamically grow to an even larger number. Also the stacks of * Win32 threads can dynamically grow to several megabytes. * * In contrast, the event queues, event pools, and stack size inside the * real-time embedded (RTE) systems can be (and must be) much smaller, * because you typically can put an upper bound on the real-time behavior * and the resulting delays. * * To be able to run the unmodified applications designed originally for * RTE systems on Windows, and to reduce the odds of resource shortages in * this case, the event queues of all Active Objects are "fudged" to the * maximum dynamic range of uint_fast8_t data type, which is 0xFF * (see QF_FUDGED_QUEUE_LEN). * * NOTE2: * The callback QF_onClockTickISR() is invoked with interupts disabled * to emulate the ISR level. This means that only the ISR-level APIs are * available inside the QF_onClockTickISR() callback. */ ================================================ FILE: ports/win32-qv/qwin_gui.c ================================================ /** * @file * @brief QWIN GUI facilities for building realistic embedded front panels * @cond ****************************************************************************** * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qwin_gui.h" #include static HWND l_hWnd; static HDC l_hDC; /*--------------------------------------------------------------------------*/ HWND CreateCustDialog(HINSTANCE hInst, int iDlg, HWND hParent, WNDPROC lpfnWndProc, LPCTSTR lpWndClass) { WNDCLASSEX wndclass; wndclass.cbSize = sizeof(wndclass); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = lpfnWndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = DLGWINDOWEXTRA; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)COLOR_WINDOW; wndclass.lpszMenuName = NULL; wndclass.lpszClassName = lpWndClass; wndclass.hIconSm = NULL; RegisterClassEx(&wndclass); l_hWnd = CreateDialog(hInst, MAKEINTRESOURCE(iDlg), hParent, NULL); l_hDC = GetDC(l_hWnd); /* obtain the DC for the client area of the window */ /* NOTE: WM_INITDIALOG provides stimulus for initializing dialog controls. * Dialog box procedures typically use this message to initialize controls * and carry out any other initialization tasks that affect the appearance * of the dialog box. */ SendMessage(l_hWnd, WM_INITDIALOG, (WPARAM)0, (LPARAM)0); return l_hWnd; } /*--------------------------------------------------------------------------*/ void OwnerDrawnButton_init(OwnerDrawnButton * const me, UINT itemID, HBITMAP hBitmapUp, HBITMAP hBitmapDwn, HCURSOR hCursor) { me->itemID = itemID; me->hBitmapUp = hBitmapUp; me->hBitmapDown = hBitmapDwn; me->hCursor = hCursor; me->isDepressed = 0; } /*..........................................................................*/ void OwnerDrawnButton_xtor(OwnerDrawnButton * const me) { DeleteObject(me->hBitmapUp); DeleteObject(me->hBitmapDown); DeleteObject(me->hCursor); } /*..........................................................................*/ enum OwnerDrawnButtonAction OwnerDrawnButton_draw( OwnerDrawnButton * const me, LPDRAWITEMSTRUCT lpdis) { enum OwnerDrawnButtonAction ret = BTN_NOACTION; if ((lpdis->itemAction & ODA_DRAWENTIRE) != 0U) { if (me->hCursor != NULL) { SetClassLongPtr(lpdis->hwndItem, GCLP_HCURSOR, (LONG_PTR)me->hCursor); me->hCursor = NULL; /* mark the cursor set */ } DrawBitmap(lpdis->hDC, me->hBitmapUp, lpdis->rcItem.left, lpdis->rcItem.top); me->isDepressed = 0; ret = BTN_PAINTED; } else if ((lpdis->itemAction & ODA_SELECT) != 0U) { if ((lpdis->itemState & ODS_SELECTED) != 0U) { DrawBitmap(lpdis->hDC, me->hBitmapDown, lpdis->rcItem.left, lpdis->rcItem.top); me->isDepressed = !0; ret = BTN_DEPRESSED; } else { /* NOTE: the bitmap for button "UP" look will be * drawn in the ODA_DRAWENTIRE action */ me->isDepressed = 0; ret = BTN_RELEASED; } } return ret; } /*..........................................................................*/ void OwnerDrawnButton_set(OwnerDrawnButton * const me, int isDepressed) { if (me->isDepressed != isDepressed) { HWND hItem = GetDlgItem(l_hWnd, me->itemID); me->isDepressed = isDepressed; if (isDepressed) { DrawBitmap(GetDC(hItem), me->hBitmapDown, 0, 0); } else { DrawBitmap(GetDC(hItem), me->hBitmapUp, 0, 0); } } } /*..........................................................................*/ BOOL OwnerDrawnButton_isDepressed(OwnerDrawnButton const * const me) { return me->isDepressed; } /*--------------------------------------------------------------------------*/ void GraphicDisplay_init(GraphicDisplay * const me, UINT width, UINT height, UINT itemID, BYTE const bgColor[3]) { BITMAPINFO bi24BitInfo; RECT rect; me->src_width = width; me->src_height = height; me->hItem = GetDlgItem(l_hWnd, itemID); me->dst_hDC = GetDC(me->hItem); GetWindowRect(me->hItem, &rect); me->dst_width = rect.right - rect.left; me->dst_height = rect.bottom - rect.top; me->bgColor[0] = bgColor[0]; me->bgColor[1] = bgColor[1]; me->bgColor[2] = bgColor[2]; bi24BitInfo.bmiHeader.biBitCount = 3U*8U; /* 3 RGB bytes */ bi24BitInfo.bmiHeader.biCompression = BI_RGB; /* RGB color */ bi24BitInfo.bmiHeader.biPlanes = 1U; bi24BitInfo.bmiHeader.biSize = sizeof(bi24BitInfo.bmiHeader); bi24BitInfo.bmiHeader.biWidth = me->src_width; bi24BitInfo.bmiHeader.biHeight = me->src_height; me->src_hDC = CreateCompatibleDC(me->dst_hDC); me->hBitmap = CreateDIBSection(me->src_hDC, &bi24BitInfo, DIB_RGB_COLORS, (void **)&me->bits, 0, 0); SelectObject(me->src_hDC, me->hBitmap); GraphicDisplay_clear(me); GraphicDisplay_redraw(me); } /*..........................................................................*/ void GraphicDisplay_xtor(GraphicDisplay * const me) { DeleteDC(me->src_hDC); DeleteObject(me->hBitmap); OutputDebugString("GraphicDisplay_xtor\n"); } /*..........................................................................*/ void GraphicDisplay_clear(GraphicDisplay * const me) { UINT n; BYTE r = me->bgColor[0]; BYTE g = me->bgColor[1]; BYTE b = me->bgColor[2]; BYTE *bits = me->bits; for (n = me->src_width * me->src_height; n != 0U; --n, bits += 3) { bits[0] = b; bits[1] = g; bits[2] = r; } } /*..........................................................................*/ void GraphicDisplay_redraw(GraphicDisplay * const me) { StretchBlt(me->dst_hDC, 0, 0, me->dst_width, me->dst_height, me->src_hDC, 0, 0, me->src_width, me->src_height, SRCCOPY); } /* SegmentDisplay ----------------------------------------------------------*/ void SegmentDisplay_init(SegmentDisplay * const me, UINT segmentNum, UINT bitmapNum) { UINT n; me->hSegment = (HWND *)calloc(segmentNum, sizeof(HWND)); me->segmentNum = segmentNum; for (n = 0U; n < segmentNum; ++n) { me->hSegment[n] = NULL; } me->hBitmap = (HBITMAP *)calloc(bitmapNum, sizeof(HBITMAP)); me->bitmapNum = bitmapNum; for (n = 0U; n < bitmapNum; ++n) { me->hBitmap[n] = NULL; } } /*..........................................................................*/ void SegmentDisplay_xtor(SegmentDisplay * const me) { UINT n; for (n = 0U; n < me->segmentNum; ++n) { DeleteObject(me->hSegment[n]); } free(me->hSegment); for (n = 0U; n < me->bitmapNum; ++n) { DeleteObject(me->hBitmap[n]); } free(me->hBitmap); } /*..........................................................................*/ BOOL SegmentDisplay_initSegment(SegmentDisplay * const me, UINT segmentNum, UINT segmentID) { if (segmentNum < me->segmentNum) { me->hSegment[segmentNum] = GetDlgItem(l_hWnd, segmentID); return me->hSegment[segmentNum] != NULL; } else { return FALSE; } } /*..........................................................................*/ BOOL SegmentDisplay_initBitmap(SegmentDisplay * const me, UINT bitmapNum, HBITMAP hBitmap) { if ((bitmapNum < me->bitmapNum) && (hBitmap != NULL)) { me->hBitmap[bitmapNum] = hBitmap; return TRUE; } else { return FALSE; } } /*..........................................................................*/ BOOL SegmentDisplay_setSegment(SegmentDisplay * const me, UINT segmentNum, UINT bitmapNum) { if ((segmentNum < me->segmentNum) && (bitmapNum < me->bitmapNum)) { SendMessage(me->hSegment[segmentNum], STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)me->hBitmap[bitmapNum]); return TRUE; } else { return FALSE; } } /*--------------------------------------------------------------------------*/ /* DrawBitmap() function adapted from the book "Programming Windows" by * Charles Petzold. */ void DrawBitmap(HDC hdc, HBITMAP hBitmap, int xStart, int yStart) { BITMAP bm; POINT ptSize, ptOrg; HDC hdcMem = CreateCompatibleDC(hdc); SelectObject(hdcMem, hBitmap); SetMapMode(hdcMem, GetMapMode(hdc)); GetObject(hBitmap, sizeof(BITMAP), (LPVOID)&bm); ptSize.x = bm.bmWidth; ptSize.y = bm.bmHeight; DPtoLP(hdc, &ptSize, 1); ptOrg.x = 0; ptOrg.y = 0; DPtoLP(hdcMem, &ptOrg, 1); BitBlt(hdc, xStart, yStart, ptSize.x, ptSize.y, hdcMem, ptOrg.x, ptOrg.y, SRCCOPY); DeleteDC(hdcMem); } ================================================ FILE: ports/win32-qv/qwin_gui.h ================================================ /** * @file * @brief QWIN GUI facilities for building realistic embedded front panels * @cond ****************************************************************************** * Last updated for version 6.6.0 * Last updated on 2019-07-30 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2019 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef QWIN_GUI_H #define QWIN_GUI_H #ifndef QWIN_GUI #error The pre-processor macro QWIN_GUI must be defined #endif #define WIN32_LEAN_AND_MEAN #include /* Win32 API */ #ifdef __cplusplus extern "C" { #endif /* create the custom dialog hosting the embedded front panel ...............*/ HWND CreateCustDialog(HINSTANCE hInst, int iDlg, HWND hParent, WNDPROC lpfnWndProc, LPCTSTR lpWndClass); /* OwnerDrawnButton "class" ................................................*/ typedef struct { UINT itemID; HBITMAP hBitmapUp; HBITMAP hBitmapDown; HCURSOR hCursor; int isDepressed; } OwnerDrawnButton; enum OwnerDrawnButtonAction { BTN_NOACTION, BTN_PAINTED, BTN_DEPRESSED, BTN_RELEASED }; void OwnerDrawnButton_init(OwnerDrawnButton * const me, UINT itemID, HBITMAP hBitmapUp, HBITMAP hBitmapDwn, HCURSOR hCursor); void OwnerDrawnButton_xtor(OwnerDrawnButton * const me); enum OwnerDrawnButtonAction OwnerDrawnButton_draw( OwnerDrawnButton * const me, LPDRAWITEMSTRUCT lpdis); void OwnerDrawnButton_set(OwnerDrawnButton * const me, int isDepressed); BOOL OwnerDrawnButton_isDepressed(OwnerDrawnButton const * const me); /* GraphicDisplay "class" for drawing graphic displays * with up to 24-bit color... */ typedef struct { HDC src_hDC; int src_width; int src_height; HDC dst_hDC; int dst_width; int dst_height; HWND hItem; HBITMAP hBitmap; BYTE *bits; BYTE bgColor[3]; } GraphicDisplay; void GraphicDisplay_init(GraphicDisplay * const me, UINT width, UINT height, UINT itemID, BYTE const bgColor[3]); void GraphicDisplay_xtor(GraphicDisplay * const me); void GraphicDisplay_clear(GraphicDisplay * const me); void GraphicDisplay_redraw(GraphicDisplay * const me); #define GraphicDisplay_setPixel(me_, x_, y_, color_) do { \ BYTE *pixelRGB = &(me_)->bits[3*((x_) \ + (me_)->src_width * ((me_)->src_height - 1U - (y_)))]; \ pixelRGB[0] = (color_)[0]; \ pixelRGB[1] = (color_)[1]; \ pixelRGB[2] = (color_)[2]; \ } while (false) #define GraphicDisplay_clearPixel(me_, x_, y_) do { \ BYTE *pixelRGB = &(me_)->bits[3*((x_) \ + (me_)->src_width * ((me_)->src_height - 1U - (y_)))]; \ pixelRGB[0] = (me_)->bgColor[0]; \ pixelRGB[1] = (me_)->bgColor[1]; \ pixelRGB[2] = (me_)->bgColor[2]; \ } while (false) /* SegmentDisplay "class" for drawing segment displays, LEDs, etc...........*/ typedef struct { HWND *hSegment; /* array of segment controls */ UINT segmentNum; /* number of segments */ HBITMAP *hBitmap; /* array of bitmap handles */ UINT bitmapNum; /* number of bitmaps */ } SegmentDisplay; void SegmentDisplay_init(SegmentDisplay * const me, UINT segNum, UINT bitmapNum); void SegmentDisplay_xtor(SegmentDisplay * const me); BOOL SegmentDisplay_initSegment(SegmentDisplay * const me, UINT segmentNum, UINT segmentID); BOOL SegmentDisplay_initBitmap(SegmentDisplay * const me, UINT bitmapNum, HBITMAP hBitmap); BOOL SegmentDisplay_setSegment(SegmentDisplay * const me, UINT segmentNum, UINT bitmapNum); /* useful helper functions .................................................*/ void DrawBitmap(HDC hdc, HBITMAP hBitmap, int xStart, int yStart); #ifdef __cplusplus } #endif #endif /* QWIN_GUI_H */ ================================================ FILE: ports/win32-qv/safe_std.h ================================================ /** * @file * @brief "safe" and facilities * @ingroup qpspy * @cond ****************************************************************************** * Last updated for version 6.8.1 * Last updated on 2020-03-31 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #ifndef SAFE_STD_H #define SAFE_STD_H #include #include /* portable "safe" facilities from and ................*/ #ifdef _WIN32 /* Windows OS? */ #define MEMMOVE_S(dest_, num_, src_, count_) \ memmove_s(dest_, num_, src_, count_) #define STRCPY_S(dest_, destsiz_, src_) \ strcpy_s(dest_, destsiz_, src_) #define STRCAT_S(dest_, destsiz_, src_) \ strcat_s(dest_, destsiz_, src_) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ _snprintf_s(buf_, bufsiz_, _TRUNCATE, format_, ##__VA_ARGS__) #define PRINTF_S(format_, ...) \ printf_s(format_, ##__VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ fprintf_s(fp_, format_, ##__VA_ARGS__) #ifdef _MSC_VER #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread_s(buf_, bufsiz_, elsiz_, count_, fp_) #else #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread(buf_, elsiz_, count_, fp_) #endif /* _MSC_VER */ #define FOPEN_S(fp_, fName_, mode_) \ if (fopen_s(&fp_, fName_, mode_) != 0) { \ fp_ = (FILE *)0; \ } else (void)0 #define LOCALTIME_S(tm_, time_) \ localtime_s(tm_, time_) #else /* other OS (Linux, MacOS, etc.) .....................................*/ #define MEMMOVE_S(dest_, num_, src_, count_) \ memmove(dest_, src_, count_) #define STRCPY_S(dest_, destsiz_, src_) \ strcpy(dest_, src_) #define STRCAT_S(dest_, destsiz_, src_) \ strcat(dest_, src) #define SNPRINTF_S(buf_, bufsiz_, format_, ...) \ snprintf(buf_, bufsiz_, format_, ##__VA_ARGS__) #define PRINTF_S(format_, ...) \ printf(format_, ##__VA_ARGS__) #define FPRINTF_S(fp_, format_, ...) \ fprintf(fp_, format_, ##__VA_ARGS__) #define FREAD_S(buf_, bufsiz_, elsiz_, count_, fp_) \ fread(buf_, elsiz_, count_, fp_) #define FOPEN_S(fp_, fName_, mode_) \ (fp_ = fopen(fName_, mode_)) #define LOCALTIME_S(tm_, time_) \ memcpy(tm_, localtime(time_), sizeof(struct tm)) #endif /* _WIN32 */ #endif /* SAFE_STD_H */ ================================================ FILE: src/qfn/qepn.c ================================================ /** * @file * @brief QEP-nano implementation. * @ingroup qep * @cond ****************************************************************************** * Last updated for version 6.8.2 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #include "qassert.h" /* embedded systems-friendly assertions */ Q_DEFINE_THIS_MODULE("qepn") /****************************************************************************/ char_t const Q_ROM QP_versionStr[7] = QP_VERSION_STR; /****************************************************************************/ /****************************************************************************/ /*! empty signal for internal use only */ #define QEP_EMPTY_SIG_ ((QSignal)0) /*! maximum depth of state nesting in HSMs (including the top level), * must be >= 2 */ #define QHSM_MAX_NEST_DEPTH_ ((int_fast8_t)5) /*! helper function to execute a transition chain in HSM */ static int_fast8_t QHsm_tran_(QHsm * const me, QStateHandler path[QHSM_MAX_NEST_DEPTH_]); /****************************************************************************/ /** * @protected @memberof QHsm * @description * Performs the first step of HSM initialization by assigning the initial * pseudostate to the currently active state of the state machine. * * @param[in,out] me pointer (see @ref oop) * @param[in] initial pointer to the top-most initial state-handler * function in the derived state machine * @note * Must be called only by the constructors of the derived state machines. * * @note * Must be called only ONCE before QHSM_INIT(). * * @usage * The following example illustrates how to invoke QHsm_ctor() in the * "constructor" of a derived state machine: * @include qepn_qhsm_ctor.c */ void QHsm_ctor(QHsm * const me, QStateHandler initial) { static QHsmVtable const vtable = { /* QHsm virtual table */ &QHsm_init_, &QHsm_dispatch_ }; me->vptr = &vtable; me->state = Q_STATE_CAST(&QHsm_top); me->temp = initial; } /****************************************************************************/ /** * @private @memberof QHsm * @description * Executes the top-most initial transition in a HSM. * * @param[in,out] me pointer (see @ref oop) * * @note * Must be called only ONCE after the QHsm_ctor(). */ void QHsm_init_(QHsm * const me) { QStateHandler t = me->state; QState r; /** @pre the virtual pointer must be initialized, the top-most initial * transition must be initialized, and the initial transition must not * be taken yet. */ Q_REQUIRE_ID(200, (me->vptr != (QHsmVtable const *)0) && (me->temp != Q_STATE_CAST(0)) && (t == Q_STATE_CAST(&QHsm_top))); r = (*me->temp)(me); /* execute the top-most initial transition */ /* the top-most initial transition must be taken */ Q_ASSERT_ID(210, r == Q_RET_TRAN); /* drill down into the state hierarchy with initial transitions... */ do { QStateHandler path[QHSM_MAX_NEST_DEPTH_]; int_fast8_t ip = 0; /* transition entry path index */ path[0] = me->temp; Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*me->temp)(me); while (me->temp != t) { ++ip; Q_ASSERT_ID(220, ip < (int_fast8_t)Q_DIM(path)); path[ip] = me->temp; (void)(*me->temp)(me); } me->temp = path[0]; /* retrace the entry path in reverse (desired) order... */ Q_SIG(me) = Q_ENTRY_SIG; do { (void)(*path[ip])(me); /* enter path[ip] */ --ip; } while (ip >= 0); t = path[0]; /* current state becomes the new source */ Q_SIG(me) = Q_INIT_SIG; r = (*t)(me); } while (r == Q_RET_TRAN); me->state = t; /* change the current active state */ me->temp = t; /* mark the configuration as stable */ } /****************************************************************************/ /** * @protected @memberof QHsm * @description * QHsm_top() is the ultimate root of state hierarchy in all HSMs derived * from ::QHsm. * * @param[in] me pointer (see @ref oop) * * @returns * Always returns #Q_RET_IGNORED, which means that the top state ignores * all events. * * @note * The parameter @p me to this state handler is not used. It is provided for * conformance with the state-handler function signature ::QStateHandler. */ QState QHsm_top(void const * const me) { (void)me; /* suppress the "unused parameter" compiler warning */ return Q_RET_IGNORED; /* the top state ignores all events */ } /****************************************************************************/ /** * @private @memberof QHsm * @description * Dispatches an event for processing to a hierarchical state machine (HSM). * The processing of an event represents one run-to-completion (RTC) step. * * @param[in,out] me pointer (see @ref oop) * * @note * This function should be called only via the virtual table (see * QHSM_DISPATCH()) and should NOT be called directly in the applications. */ void QHsm_dispatch_(QHsm * const me) { QStateHandler t = me->state; QStateHandler s; QState r; int_fast8_t iq; /* helper transition entry path index */ /** @pre the current state must be initialized and * the state configuration must be stable */ Q_REQUIRE_ID(400, (t != Q_STATE_CAST(0)) && (t == me->temp)); /* process the event hierarchically... */ do { s = me->temp; r = (*s)(me); /* invoke state handler s */ if (r == Q_RET_UNHANDLED) { /* unhandled due to a guard? */ iq = (int_fast8_t)Q_SIG(me); /* save the original signal */ Q_SIG(me) = QEP_EMPTY_SIG_; /* find the superstate */ r = (*s)(me); /* invoke state handler s */ Q_SIG(me) = (QSignal)iq; /* restore the original signal */ } } while (r == Q_RET_SUPER); /* transition taken? */ if (r >= Q_RET_TRAN) { QStateHandler path[QHSM_MAX_NEST_DEPTH_]; /* transition entry path */ int_fast8_t ip; /* transition entry path index */ path[0] = me->temp; /* save the target of the transition */ path[1] = t; path[2] = s; /* exit current state to transition source s... */ for (; t != s; t = me->temp) { Q_SIG(me) = Q_EXIT_SIG; /* find superstate of t */ /* take the exit action and check if it was handled? */ if ((*t)(me) == Q_RET_HANDLED) { Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*t)(me); /* find superstate of t */ } } ip = QHsm_tran_(me, path); /* take the state transition */ /* retrace the entry path in reverse (desired) order... */ Q_SIG(me) = Q_ENTRY_SIG; for (; ip >= 0; --ip) { (void)(*path[ip])(me); /* enter path[ip] */ } t = path[0]; /* stick the target into register */ me->temp = t; /* update the current state */ /* drill into the target hierarchy... */ Q_SIG(me) = Q_INIT_SIG; while ((*t)(me) == Q_RET_TRAN) { ip = 0; path[0] = me->temp; Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*me->temp)(me); /* find the superstate */ while (me->temp != t) { ++ip; path[ip] = me->temp; (void)(*me->temp)(me); /* find the superstate */ } me->temp = path[0]; /* entry path must not overflow */ Q_ASSERT_ID(410, ip < QHSM_MAX_NEST_DEPTH_); /* retrace the entry path in reverse (correct) order... */ Q_SIG(me) = Q_ENTRY_SIG; do { (void)(*path[ip])(me); /* enter path[ip] */ --ip; } while (ip >= 0); t = path[0]; Q_SIG(me) = Q_INIT_SIG; } } me->state = t; /* change the current active state */ me->temp = t; /* mark the configuration as stable */ } /****************************************************************************/ /** * @private @memberof QHsm * @description * Static helper function to execute transition sequence in a hierarchical * state machine (HSM). * * @param[in,out] me pointer (see @ref oop) * @param[in,out] path array of pointers to state-handler functions * to execute the entry actions * @returns * the depth of the entry path stored in the @p path parameter. */ static int_fast8_t QHsm_tran_(QHsm * const me, QStateHandler path[QHSM_MAX_NEST_DEPTH_]) { int_fast8_t ip = (int_fast8_t)(-1); /* transition entry path index */ int_fast8_t iq; /* helper transition entry path index */ QStateHandler t = path[0]; QStateHandler s = path[2]; QState r; /* (a) check source==target (transition to self) */ if (s == t) { Q_SIG(me) = Q_EXIT_SIG; (void)(*s)(me); /* exit the source */ ip = 0; /* enter the target */ } else { Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*t)(me); /* find superstate of target */ t = me->temp; /* (b) check source==target->super */ if (s == t) { ip = 0; /* enter the target */ } else { Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*s)(me); /* find superstate of source */ /* (c) check source->super==target->super */ if (me->temp == t) { Q_SIG(me) = Q_EXIT_SIG; (void)(*s)(me); /* exit the source */ ip = 0; /* enter the target */ } else { /* (d) check source->super==target */ if (me->temp == path[0]) { Q_SIG(me) = Q_EXIT_SIG; (void)(*s)(me); /* exit the source */ } else { /* (e) check rest of source==target->super->super.. * and store the entry path along the way */ iq = 0; /* indicate that LCA not found */ ip = 1; /* enter target and its superstate */ path[1] = t; /* save the superstate of target */ t = me->temp; /* save source->super */ /* find target->super->super... */ Q_SIG(me) = QEP_EMPTY_SIG_; r = (*path[1])(me); while (r == Q_RET_SUPER) { ++ip; path[ip] = me->temp; /* store the entry path */ if (me->temp == s) { /* is it the source? */ iq = 1; /* indicate that LCA found */ /* entry path must not overflow */ Q_ASSERT_ID(510, ip < QHSM_MAX_NEST_DEPTH_); --ip; /* do not enter the source */ r = Q_RET_HANDLED; /* terminate loop */ } /* it is not the source, keep going up */ else { r = (*me->temp)(me); /* superstate of t */ } } /* the LCA not found yet? */ if (iq == 0) { /* entry path must not overflow */ Q_ASSERT_ID(520, ip < QHSM_MAX_NEST_DEPTH_); Q_SIG(me) = Q_EXIT_SIG; (void)(*s)(me); /* exit the source */ /* (f) check the rest of source->super * == target->super->super... */ iq = ip; r = Q_RET_IGNORED; /* LCA NOT found */ do { if (t == path[iq]) { /* is this the LCA? */ r = Q_RET_HANDLED; /* LCA found */ /* do not enter LCA */ ip = (int_fast8_t)(iq - 1); iq = -1; /* force loop termination */ } else { --iq; /* try lower superstate of target */ } } while (iq >= 0); /* LCA not found? */ if (r != Q_RET_HANDLED) { /* (g) check each source->super->... * for each target->super... */ r = Q_RET_IGNORED; /* keep looping */ do { /* exit t unhandled? */ Q_SIG(me) = Q_EXIT_SIG; if ((*t)(me) == Q_RET_HANDLED) { Q_SIG(me) = QEP_EMPTY_SIG_; (void)(*t)(me); /* find super of t */ } t = me->temp; /* set to super of t */ iq = ip; do { /* is this LCA? */ if (t == path[iq]) { /* do not enter LCA */ ip = (int_fast8_t)(iq - 1); iq = -1; /* break out of inner loop */ r = Q_RET_HANDLED; /* break */ } else { --iq; } } while (iq >= 0); } while (r != Q_RET_HANDLED); } } } } } } return ip; } /****************************************************************************/ /** * @private @memberof QHsm * @description * Finds the child state of the given @c parent, such that this child state * is an ancestor of the currently active state. The main purpose of this * function is to support **shallow history** transitions in state machines * derived from QHsm. * * @param[in] me pointer (see @ref oop) * @param[in] parent pointer to the state-handler function * * @returns * the child of a given @c parent state, which is an ancestor of the current * active state. For the corner case when the currently active state is the * given @c parent state, function returns the @c parent state. * * @note * This function is designed to be called during state transitions, so it * does not necessarily start in a stable state configuration. However, the * function establishes stable state configuration upon exit. * * @sa * QHsm_childState() */ QStateHandler QHsm_childState_(QHsm * const me, QStateHandler const parent) { QStateHandler child = me->state; /* start with the current state */ bool isFound = false; /* start with the child not found */ QState r; /* establish stable state configuration */ me->temp = me->state; do { /* is this the parent of the current child? */ if (me->temp == parent) { isFound = true; /* child is found */ r = Q_RET_IGNORED; /* break out of the loop */ } else { child = me->temp; Q_SIG(me) = QEP_EMPTY_SIG_; r = (*me->temp)(me); /* find the superstate */ } } while (r != Q_RET_IGNORED); /* QHsm_top() state not reached */ me->temp = me->state; /* establish stable state configuration */ /** @post the child must be found */ Q_ENSURE_ID(810, isFound != false); #ifdef Q_NASSERT (void)isFound; /* avoid compiler warning about unused variable */ #endif return child; /* return the child */ } ================================================ FILE: src/qfn/qfn.c ================================================ /** * @file * @brief QF-nano implementation. * @ingroup qfn * @cond ****************************************************************************** * Last updated for version 6.8.2 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #include "qassert.h" /* embedded systems-friendly assertions */ Q_DEFINE_THIS_MODULE("qfn") /* Global-scope objects *****************************************************/ /** * @description * This variable stores the number of active objects in the application. * This is the number of elements (dimension of) the QF_active[] array. */ uint_fast8_t QF_maxActive_; /** * @description * The QF-nano ready set keeps track of active objects that are ready to run. * The ready set represents each active object as a bit, with the bits * assigned according to priorities of the active objects. The bit is set * if the corresponding active object is ready to run (i.e., has one or * more events in its event queue) and zero if the event queue is empty. * The QF-nano ready set is one byte-wide, which corresponds to 8 active * objects maximum. */ uint_fast8_t volatile QF_readySet_; #ifdef QF_TIMEEVT_USAGE /** * @description * The QF-nano timer set keeps track of the armed time events. The timer set * represents the timeout down-counter of each active object as a bit, with * the bits assigned according to priorities of the active objects. The bit * is set if the corresponding timeout down-counter is not zero (i.e., is * counting down) and zero if the down-counter is zero. The QF-nano time event * set is one byte-wide, which corresponds to 8 active objects maximum.@n * @n * The main use of the QF_timerSetX_ is to quickly determine that all time * events are disarmed by testing (QF_timerSetX_[tickRate] == 0). * If so, the CPU can go to longer sleep mode, in which the system clock * tick ISR is turned off. * * @note The test (QF_timerSet_[tickRate] == 0) must be always performed * inside a CRITICAL SECTION. */ uint_fast8_t volatile QF_timerSetX_[QF_MAX_TICK_RATE]; #endif #ifndef QF_LOG2 uint8_t const Q_ROM QF_log2Lkup[16] = { 0U, 1U, 2U, 2U, 3U, 3U, 3U, 3U, 4U, 4U, 4U, 4U, 4U, 4U, 4U, 4U }; #endif /* QF_LOG2 */ /****************************************************************************/ /** * @protected @memberof QActive */ void QActive_ctor(QActive * const me, QStateHandler initial) { static QActiveVtable const vtable = { /* QActive virtual table */ { &QHsm_init_, &QHsm_dispatch_ }, &QActive_postX_, &QActive_postXISR_ }; /** * @note QActive inherits QActive, so by the @ref oop convention * it should call the constructor of the superclass, i.e., QActive_ctor(). * However, this would pull in the QActiveVtable, which in turn will pull * in the code for QHsm_init_() and QHsm_dispatch_() implemetations, * which is expensive. To avoid this code size penalty, in case ::QHsm is * not used in a given project, the call to QHsm_ctor() avoids pulling * in the code for QHsm. */ QHsm_ctor(&me->super, initial); me->super.vptr = &vtable.super; /* hook the vptr to QActive vtable */ } /****************************************************************************/ /** * @private @memberof QActive * @description * Direct event posting is the simplest asynchronous communication method * available in QF-nano. * * @attention * This function should be called only via the macro QACTIVE_POST() * or QACTIVE_POST_X(). This function should be only used in the * __task__ context. * * @param[in,out] me pointer (see @ref oop) * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN * means that this function will assert if posting fails. * @param[in] sig signal of the event to be posted * @param[in] par parameter of the event to be posted * * @usage * @include qfn_postx.c */ #if (Q_PARAM_SIZE != 0U) bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postX_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { QActiveCB const Q_ROM *acb = &QF_active[me->prio]; uint_fast8_t qlen = Q_ROM_BYTE(acb->qlen); bool can_post; QF_INT_DISABLE(); if (margin == QF_NO_MARGIN) { if (qlen > (uint_fast8_t)me->nUsed) { can_post = true; /* can post */ } else { can_post = false; /* cannot post */ #ifndef Q_NASSERT QF_INT_ENABLE(); /* must be able to post event : Q_ERROR_ID(310) */ Q_onAssert(Q_this_module_, 310); #endif } } else if ((qlen - (uint_fast8_t)me->nUsed) > margin) { can_post = true; /* can post */ } else { can_post = false; /* cannot post */ } if (can_post) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_ROM_QUEUE_AT_(acb, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0U) QF_ROM_QUEUE_AT_(acb, me->head).par = par; #endif if (me->head == 0U) { me->head = (uint8_t)qlen; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the corresponding bit in the ready set */ QF_readySet_ |= (uint_fast8_t)1 << (me->prio - 1U); #ifdef qkn_h if (QK_sched_() != 0U) { QK_activate_(); /* activate the next active object */ } #endif } } QF_INT_ENABLE(); return can_post; } /****************************************************************************/ /** * @private @memberof QActive * @description * Direct event posting is the simplest asynchronous communication method * available in QF-nano. * * @attention * This function should be called only via the macro QACTIVE_POST_ISR() * or QACTIVE_POST_X_ISR(). This function should be only used in the * __ISR__ context. * * @param[in,out] me pointer (see @ref oop) * @param[in] margin number of required free slots in the queue after * posting the event. The special value #QF_NO_MARGIN * means that this function will assert if posting fails. * @param[in] sig signal of the event to be posted * @param[in] par parameter of the event to be posted * * @usage * @include qfn_postx.c */ #if (Q_PARAM_SIZE != 0U) bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig, QParam const par) #else bool QActive_postXISR_(QActive * const me, uint_fast8_t margin, enum_t const sig) #endif { #ifdef QF_ISR_NEST #ifdef QF_ISR_STAT_TYPE QF_ISR_STAT_TYPE stat; #endif #endif QActiveCB const Q_ROM *acb = &QF_active[me->prio]; uint_fast8_t qlen = Q_ROM_BYTE(acb->qlen); bool can_post; #ifdef QF_ISR_NEST #ifdef QF_ISR_STAT_TYPE QF_ISR_DISABLE(stat); #else QF_INT_DISABLE(); #endif #endif if (margin == QF_NO_MARGIN) { if (qlen > (uint_fast8_t)me->nUsed) { can_post = true; /* can post */ } else { can_post = false; /* cannot post */ #ifndef Q_NASSERT QF_INT_ENABLE(); /* must be able to post event : Q_ERROR_ID(410) */ Q_onAssert(Q_this_module_, 410); #endif } } else if ((qlen - (uint_fast8_t)me->nUsed) > margin) { can_post = true; /* can post */ } else { can_post = false; /* cannot post */ } if (can_post) { /* can post the event? */ /* insert event into the ring buffer (FIFO) */ QF_ROM_QUEUE_AT_(acb, me->head).sig = (QSignal)sig; #if (Q_PARAM_SIZE != 0U) QF_ROM_QUEUE_AT_(acb, me->head).par = par; #endif if (me->head == 0U) { me->head = (uint8_t)qlen; /* wrap the head */ } --me->head; ++me->nUsed; /* is this the first event? */ if (me->nUsed == 1U) { /* set the bit */ QF_readySet_ |= (uint_fast8_t)1 << (me->prio - 1U); } } #ifdef QF_ISR_NEST #ifdef QF_ISR_STAT_TYPE QF_ISR_RESTORE(stat); #else QF_INT_ENABLE(); #endif #endif return can_post; } /****************************************************************************/ /** * @description * The function QF_init() initializes the number of active objects to be * managed by the framework and clears the internal QF-nano variables as well * as all registered active objects to zero, which is needed in case when * the startup code does not clear the uninitialized data (in violation of * the C Standard). * * @note * The intended use of the function is to call as follows: * QF_init(Q_DIM(QF_active)); */ void QF_init(uint_fast8_t maxActive) { QActive *a; uint_fast8_t p; uint_fast8_t n; /** @pre the number of active objects must be in range */ Q_REQUIRE_ID(100, (1U < maxActive) && (maxActive <= 9U)); QF_maxActive_ = (uint_fast8_t)maxActive - 1U; #ifdef QF_TIMEEVT_USAGE for (n = 0U; n < (uint_fast8_t)QF_MAX_TICK_RATE; ++n) { QF_timerSetX_[n] = 0U; } #endif /* QF_TIMEEVT_USAGE */ QF_readySet_ = 0U; #ifdef qkn_h QK_attr_.actPrio = 8U; /* QK-nano scheduler locked */ #ifdef QF_ISR_NEST QK_attr_.intNest = 0U; #endif #ifdef QK_SCHED_LOCK QK_attr_.lockPrio = 0U; QK_attr_.lockHolder = 0U; #endif #endif /* #ifdef qkn_h */ /* clear all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(110, a != (QActive *)0); a->head = 0U; a->tail = 0U; a->nUsed = 0U; #if (QF_TIMEEVT_CTR_SIZE != 0U) for (n = 0U; n < (uint_fast8_t)QF_MAX_TICK_RATE; ++n) { a->tickCtr[n].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC a->tickCtr[n].interval = 0U; #endif /* def QF_TIMEEVT_PERIODIC */ } #endif /* (QF_TIMEEVT_CTR_SIZE != 0U) */ } #ifdef QV_INIT /* initialization of the QV-nano kernel defined? */ QV_INIT(); /* port-specific initialization of the QV-nano kernel */ #elif defined QK_INIT /* initialization of the QK-nano kernel defined? */ QK_INIT(); /* port-specific initialization of the QK-nano kernel */ #endif } /****************************************************************************/ /****************************************************************************/ #if (QF_TIMEEVT_CTR_SIZE != 0U) /****************************************************************************/ /** * @description * This function must be called periodically from a time-tick ISR or from * an ISR so that QF-nano can manage the timeout events assigned to the given * system clock tick rate. * * @param[in] tickRate system clock tick rate serviced in this call. * * @note Each system tick rate posts timeout events with a different signal * as follows:@n * tickRate==0 Q_TIMEOUT_SIG@n * tickRate==1 Q_TIMEOUT1_SIG@n * tickRate==2 Q_TIMEOUT2_SIG@n * tickRate==3 Q_TIMEOUT3_SIG * * @note The calls to QF_tickXISR() with different tick rate parameter can * preempt each other. For example, higher clock tick rates might be serviced * from interrupts that can preempt lower-priority interrupts. */ void QF_tickXISR(uint_fast8_t const tickRate) { uint_fast8_t p = QF_maxActive_; do { QActive *a = QF_ROM_ACTIVE_GET_(p); QTimer *t = &a->tickCtr[tickRate]; if (t->nTicks != 0U) { --t->nTicks; if (t->nTicks == 0U) { #ifdef QF_TIMEEVT_PERIODIC if (t->interval != 0U) { t->nTicks = t->interval; /* re-arm the periodic timer */ } #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (p - 1U))); #endif /* QF_TIMEEVT_USAGE */ #if (Q_PARAM_SIZE != 0) QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate, 0U); #else QACTIVE_POST_ISR(a, (enum_t)Q_TIMEOUT_SIG + (enum_t)tickRate); #endif /* (Q_PARAM_SIZE != 0U) */ } } --p; } while (p != 0U); } /****************************************************************************/ /** * @public @memberof QActive * @description * Arms a time event to fire in a specified number of clock ticks at the * specified tick rate. The timeout signal gets directly posted (using the * FIFO policy) into the event queue of the active object calling this * function. * * @param[in,out] me pointer (see @ref oop) * @param[in] tickRate tick rate . * @param[in] nTicks number of clock ticks (at the associated rate) * to rearm the time event with. * * @note Each system tick rate posts timeout events with a different signal * as follows:@n * tickRate==0 Q_TIMEOUT_SIG@n * tickRate==1 Q_TIMEOUT1_SIG@n * tickRate==2 Q_TIMEOUT2_SIG@n * tickRate==3 Q_TIMEOUT3_SIG * * @note After posting, a one-shot time event gets automatically disarmed. * * @note A time event can be disarmed at any time by calling the * QActive_disarmX() function. * * @usage * The following example shows how to arm a time event from a state * machine of an active object: * @include qfn_armx.c */ #ifdef QF_TIMEEVT_PERIODIC void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks, QTimeEvtCtr const interval) #else void QActive_armX(QActive * const me, uint_fast8_t const tickRate, QTimeEvtCtr const nTicks) #endif { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = nTicks; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = interval; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* set a bit in QF_timerSetX_[] to rememer that the timer is running */ QF_timerSetX_[tickRate] |= (uint_fast8_t)1 << (me->prio - 1U); #endif QF_INT_ENABLE(); } /****************************************************************************/ /** * @public @memberof QActive * @description * The time event of the active object gets disarmed (stopped). * * @param[in,out] me pointer (see @ref oop) * @param[in] tickRate tick rate * * @note You should __not__ assume that the timeout event will not * arrive after you disarm the time event. The timeout event could be * already in the event queue. */ void QActive_disarmX(QActive * const me, uint_fast8_t const tickRate) { QF_INT_DISABLE(); me->tickCtr[tickRate].nTicks = 0U; #ifdef QF_TIMEEVT_PERIODIC me->tickCtr[tickRate].interval = 0U; #endif /* QF_TIMEEVT_PERIODIC */ #ifdef QF_TIMEEVT_USAGE /* clear a bit in QF_timerSetX_[] to rememer that timer is not running */ QF_timerSetX_[tickRate] &= (uint_fast8_t)(~(1U << (me->prio - 1U))); #endif QF_INT_ENABLE(); } #endif /* #if (QF_TIMEEVT_CTR_SIZE != 0U) */ ================================================ FILE: src/qkn/qkn.c ================================================ /** * @file * @brief QK-nano preemptive kernel implementation. * @ingroup qkn * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #include "qassert.h" /* embedded systems-friendly assertions */ Q_DEFINE_THIS_MODULE("qkn") /* protection against including this source file in a wrong project */ #ifndef QKN_H #error "Source file included in a project NOT based on the QK-nano kernel" #endif /* QKN_H */ /* Global-scope objects *****************************************************/ QK_PrivAttr QK_attr_; /* private attributes of the QK-nano kernel */ /* Local-scope objects ******************************************************/ static void initialize(void); /* prototype required by MISRA */ /****************************************************************************/ /** * @description * Helper function to set the priorities of all the statically allocated * active objects in the system followed by executing the top-most initial * transtions in all active objects. * * @note * The system initialization is specifically encapsulated in a function * to reduce stack use, because the temporary stack variables needed * for the initialization go out of scope for the rest of system execution. */ static void initialize(void) { uint_fast8_t p; QActive *a; #ifdef QF_MAX_ACTIVE /* deprecated constant provided? */ #if (QF_MAX_ACTIVE < 1) || (8 < QF_MAX_ACTIVE) #error "QF_MAX_ACTIVE not defined or out of range. Valid range is 1..8" #endif QF_maxActive_ = (uint_fast8_t)QF_MAX_ACTIVE; #else /** @pre the number of active objects must be initialized by calling: * QF_init(Q_DIM(QF_active)); */ Q_REQUIRE_ID(100, (1U <= QF_maxActive_) && (QF_maxActive_ <= (uint_fast8_t)8)); #endif /* set priorities all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(110, a != (QActive *)0); a->prio = (uint8_t)p; /* set the priority of the active object */ } /* trigger initial transitions in all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); QHSM_INIT(&a->super); /* take the initial transition in the SM */ } /* process all events posted during initialization... */ QF_INT_DISABLE(); QK_attr_.actPrio = 0U; /* prio of the QK-nano idle loop */ if (QK_sched_() != 0U) { QK_activate_(); /* activate AOs to process all events posted so far */ } QF_INT_ENABLE(); } /****************************************************************************/ /** * @description * QF_run() is typically called from your startup code after you initialize * the QF and start at least one active object with QActive_start(). * This implementation of QF_run() is for the preemptive QK-nano kernel. * * @returns * In QK-nano QF_run() does not return. */ int_t QF_run(void) { initialize(); QF_onStartup(); /* invoke startup callback */ /* the QK idle loop */ for (;;) { QK_onIdle(); /* invoke the on-idle callback */ } #ifdef __GNUC__ /* GNU compiler? */ return 0; #endif } /****************************************************************************/ /****************************************************************************/ #ifdef QK_SCHED_LOCK /****************************************************************************/ /** * @description * This function locks the QK scheduler to the specified ceiling. * * @param[in] ceiling priority ceiling to which the QK scheduler * needs to be locked * * @returns * The previous QK Scheduler lock status, which is to be used to unlock * the scheduler by restoring its previous lock status in QK_schedUnlock(). * * @note * QK_schedLock() must be always followed by the corresponding * QK_schedUnlock(). * * @sa QK_schedUnlock() * * @usage * The following example shows how to lock and unlock the QK scheduler: * @include qkn_lock.c */ QSchedStatus QK_schedLock(uint_fast8_t ceiling) { QSchedStatus stat; QF_INT_DISABLE(); /* first store the previous lock prio */ /* raising the lock prio? */ if ((uint_fast8_t)QK_attr_.lockPrio < ceiling) { stat = (QSchedStatus)QK_attr_.lockPrio << 8; QK_attr_.lockPrio = (uint8_t)ceiling; /* add the previous lock holder priority */ stat |= (QSchedStatus)QK_attr_.lockHolder; QK_attr_.lockHolder = QK_attr_.actPrio; } else { stat = 0xFFU; } QF_INT_ENABLE(); return stat; /* return the status to be saved in a stack variable */ } /****************************************************************************/ /** * @description * This function unlocks the QK scheduler to the previous status. * * @param[in] stat previous QK Scheduler lock status returned from * QK_schedLock() * @note * QK_schedUnlock() must always follow the corresponding QK_schedLock(). * * @sa QK_schedLock() * * @usage * The following example shows how to lock and unlock the QK scheduler: * @include qkn_lock.c */ void QK_schedUnlock(QSchedStatus stat) { /* has the scheduler been actually locked by the last QK_schedLock()? */ if (stat != 0xFFU) { uint_fast8_t lockPrio = (uint_fast8_t)QK_attr_.lockPrio; uint_fast8_t prevPrio = (uint_fast8_t)(stat >> 8); QF_INT_DISABLE(); /** @pre * The current lock priority must be greater than the previous */ Q_REQUIRE_ID(700, lockPrio > prevPrio); #ifdef Q_NASSERT (void)lockPrio; /* avoid compiler warning about unused variable */ #endif /* restore the previous lock priority and lock holder */ QK_attr_.lockPrio = (uint8_t)prevPrio; QK_attr_.lockHolder = (uint8_t)(stat & 0xFFU); /* find the highest-prio thread ready to run */ if (QK_sched_() != 0U) { /* priority found? */ QK_activate_(); /* activate any unlocked basic threads */ } QF_INT_ENABLE(); } } #endif /* #ifdef QK_SCHED_LOCK */ /****************************************************************************/ /****************************************************************************/ /** * @description * The QK-nano scheduler finds out the priority of the highest-priority AO * that (1) has events to process and (2) has priority that is above the * current priority. * * @returns the 1-based priority of the the active object, or zero if * no eligible active object is ready to run. * * @attention * QK_sched_() must be always called with interrupts **disabled** and * returns with interrupts **disabled**. */ uint_fast8_t QK_sched_(void) { uint_fast8_t p; /* for priority */ /* find the highest-prio AO with non-empty event queue */ #ifdef QF_LOG2 p = (uint_fast8_t)QF_LOG2(QF_readySet_); #else /* hi nibble used? */ if ((QF_readySet_ & 0xF0U) != 0U) { p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_ >> 4]) + 4U; } else { /* hi nibble of QF_readySet_ is zero */ p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_]); } #endif /* is the highest-prio below the active priority? */ if (p <= (uint_fast8_t)QK_attr_.actPrio) { p = 0U; /* active object not eligible */ } #ifdef QK_SCHED_LOCK /* below the scheduler ceiling? */ else if (p <= (uint_fast8_t)QK_attr_.lockPrio) { p = 0U; /* active object not eligible */ } #endif /* QK_SCHED_LOCK */ else { Q_ASSERT_ID(610, p <= QF_maxActive_); QK_attr_.nextPrio = (uint8_t)p; /* next AO to run */ } return p; } /****************************************************************************/ /** * @description * QK_activate_() activates ready-to run AOs that are above the initial * active priority (QK_attr_.actPrio). * * @note * The activator might enable interrupts internally, but always returns with * interrupts **disabled**. */ void QK_activate_(void) { uint_fast8_t pin = (uint_fast8_t)QK_attr_.actPrio; /* save active prio */ uint_fast8_t p = (uint_fast8_t)QK_attr_.nextPrio; /* next prio to run */ /* QK Context switch callback enabled? */ #ifdef QK_ON_CONTEXT_SW uint_fast8_t pprev = pin; #endif /* QK_ON_CONTEXT_SW */ /* QK_attr_.nextPrio must be non-zero upon entry to QK_activate_() */ Q_REQUIRE_ID(800, p != 0U); QK_attr_.nextPrio = 0U; /* clear for the next time */ /* loop until no more ready-to-run AOs of higher prio than the initial */ do { QActive *a; QActiveCB const Q_ROM *acb; QK_attr_.actPrio = (uint8_t)p; /* this becomes the active priority */ QF_INT_ENABLE(); /* it's safe to leave critical section */ acb = &QF_active[p]; a = QF_ROM_ACTIVE_GET_(p); /* map p to AO */ QF_INT_DISABLE(); /* get ready to access the queue */ /* some unused events must be available */ Q_ASSERT_ID(810, a->nUsed > 0U); --a->nUsed; Q_SIG(a) = QF_ROM_QUEUE_AT_(acb, a->tail).sig; #if (Q_PARAM_SIZE != 0) Q_PAR(a) = QF_ROM_QUEUE_AT_(acb, a->tail).par; #endif /* wrap around? */ if (a->tail == 0U) { a->tail = Q_ROM_BYTE(acb->qlen); } --a->tail; #ifdef QK_ON_CONTEXT_SW if (p != pprev) { /* changing threads? */ QK_onContextSw(pprev, p); /* context-switch callback */ pprev = p; /* update previous priority */ } #endif /* QK_ON_CONTEXT_SW */ QF_INT_ENABLE(); /* unconditionally enable interrupts */ QHSM_DISPATCH(&a->super); /* dispatch to the SM (execute RTC step) */ QF_INT_DISABLE(); if (a->nUsed == 0U) { /* empty queue? */ /* clear the ready bit */ QF_readySet_ &= (uint_fast8_t)(~(1U << (p - 1U))); } /* find new highest-prio AO ready to run... */ #ifdef QF_LOG2 p = (uint_fast8_t)QF_LOG2(QF_readySet_); #else /* hi nibble used? */ if ((QF_readySet_ & 0xF0U) != 0U) { p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_ >> 4]) + 4U; } else { /* hi nibble of QF_readySet_ is zero */ p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_]); } #endif /* is the new priority below the initial preemption threshold? */ if (p <= pin) { p = 0U; /* active object not eligible */ } #ifdef QK_SCHED_LOCK /* below the scheduler ceiling? */ else if (p <= (uint_fast8_t)QK_attr_.lockPrio) { p = 0U; /* active object not eligible */ } else { Q_ASSERT_ID(710, p <= QF_maxActive_); } #endif /* QK_SCHED_LOCK */ } while (p != 0U); QK_attr_.actPrio = (uint8_t)pin; /* restore the active priority */ #ifdef QK_ON_CONTEXT_SW QK_onContextSw(pprev, pin); /* context-switch callback */ #endif /* QK_ON_CONTEXT_SW */ } ================================================ FILE: src/qvn/qvn.c ================================================ /** * @file * @brief QV-nano implementation. * @ingroup qvn * @cond ****************************************************************************** * Last updated for version 6.8.0 * Last updated on 2020-03-08 * * Q u a n t u m L e a P s * ------------------------ * Modern Embedded Software * * Copyright (C) 2005-2020 Quantum Leaps, LLC. All rights reserved. * * This program is open source software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, this program may be distributed and modified under the * terms of Quantum Leaps commercial licenses, which expressly supersede * the GNU General Public License and are specifically designed for * licensees interested in retaining the proprietary status of their code. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Contact information: * * ****************************************************************************** * @endcond */ #include "qpn_conf.h" /* QP-nano configuration file (from the application) */ #include "qfn_port.h" /* QF-nano port from the port directory */ #include "qassert.h" /* embedded systems-friendly assertions */ Q_DEFINE_THIS_MODULE("qvn") /* protection against including this source file in a wrong project */ #ifndef QVN_H #error "Source file included in a project NOT based on the QV-nano kernel" #endif /* QVN_H */ /****************************************************************************/ /** * @description * QF_run() is typically called from your startup code after you initialize * the QF and start at least one active object with QActive_start(). * This implementation of QF_run() is for the cooperative Vanilla kernel. * * @returns QF_run() typically does not return in embedded applications. * However, when QP runs on top of an operating system, QF_run() might * return and in this case the return represents the error code (0 for * success). Typically the value returned from QF_run() is subsequently * passed on as return from main(). */ int_t QF_run(void) { uint_fast8_t p; QActive *a; #ifdef QF_MAX_ACTIVE /* deprecated constant provided? */ #if (QF_MAX_ACTIVE < 1) || (8 < QF_MAX_ACTIVE) #error "QF_MAX_ACTIVE not defined or out of range. Valid range is 1..8" #endif QF_maxActive_ = (uint_fast8_t)QF_MAX_ACTIVE; #else /** @pre the number of active objects must be initialized by calling: * QF_init(Q_DIM(QF_active)); */ Q_REQUIRE_ID(100, (1U <= QF_maxActive_) && (QF_maxActive_ <= 8U)); #endif /* set priorities all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); /* QF_active[p] must be initialized */ Q_ASSERT_ID(810, a != (QActive *)0); a->prio = (uint8_t)p; /* set the priority of the active object */ } /* trigger initial transitions in all registered active objects... */ for (p = 1U; p <= QF_maxActive_; ++p) { a = QF_ROM_ACTIVE_GET_(p); QHSM_INIT(&a->super); /* take the initial transition in the SM */ } QF_onStartup(); /* invoke startup callback */ /* the event loop of the cooperative QV-nano kernel... */ QF_INT_DISABLE(); for (;;) { if (QF_readySet_ != 0U) { QActiveCB const Q_ROM *acb; #ifdef QF_LOG2 p = QF_LOG2(QF_readySet_); #else /* hi nibble non-zero? */ if ((QF_readySet_ & 0xF0U) != 0U) { p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_ >> 4]) + 4U; } else { /* hi nibble of QF_readySet_ is zero */ p = (uint_fast8_t)Q_ROM_BYTE(QF_log2Lkup[QF_readySet_]); } #endif /* QF_LOG2 */ acb = &QF_active[p]; a = QF_ROM_ACTIVE_GET_(p); /* some unsuded events must be available */ Q_ASSERT_ID(820, a->nUsed > 0U); --a->nUsed; Q_SIG(a) = QF_ROM_QUEUE_AT_(acb, a->tail).sig; #if (Q_PARAM_SIZE != 0U) Q_PAR(a) = QF_ROM_QUEUE_AT_(acb, a->tail).par; #endif if (a->tail == 0U) { /* wrap around? */ a->tail = Q_ROM_BYTE(acb->qlen); } --a->tail; QF_INT_ENABLE(); QHSM_DISPATCH(&a->super); /* dispatch to the HSM (RTC step) */ QF_INT_DISABLE(); /* empty queue? */ if (a->nUsed == 0U) { /* clear the bit corresponding to 'p' */ QF_readySet_ &= (uint_fast8_t)~(1U << (p - 1U)); } } else { /* QV_onIdle() must be called with interrupts DISABLED because * the determination of the idle condition (no events in the * queues) can change at any time by an interrupt posting events * to a queue. QV_onIdle() MUST enable interrupts internally, * perhaps at the same time as putting the CPU into a power-saving * mode. */ QV_onIdle(); QF_INT_DISABLE(); } } #ifdef __GNUC__ /* GNU compiler? */ return 0; #endif }