Compiling KillSwitch Demo for mangOH Red

Hello,

i’m hardly trying to create a legato app that uses CAN BUS.
Actually i am trying to get the KillSwitch Demo running on mangOH Red.

But it seems that it can only run on mangOH green.

unfortunately its not compilable.

First error is in KillSwitch/canOpen/Component.cdef where the Base Path is missing:
api:
{

  •    mangoh_muxCtrl.api
    
  •    ${MANGOH_ROOT}/apps/MuxControl/mangoh_muxCtrl.api
    
    }

And some othe rlittle things… but i am ending um with several errors:

mkapp -t wp77xx killSwitch.adef
[4/22] Compiling C source
FAILED: /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/9360366597b53deec561966454cca21e/obj/37bf64dd96a9d129c4f3ab8771413d28.o
/opt/swi/SWI9X06Y_02.32.02.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc --sysroot=/opt/swi/y22-ext-wp77xx/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/9360366597b53deec561966454cca21e/obj/37bf64dd96a9d129c4f3ab8771413d28.o.d -Wall -Werror -fvisibility=hidden -c /home/kaiser/mangOH/samples/Demos/KillSwitch/canOpen/can_ctrl.c -o /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/9360366597b53deec561966454cca21e/obj/37bf64dd96a9d129c4f3ab8771413d28.o -DLE_FILENAME=basename /home/kaiser/mangOH/samples/Demos/KillSwitch/canOpen/can_ctrl.c -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -fPIC -I /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx -I/home/kaiser/legato_framework/legato/interfaces -I/home/kaiser/legato_framework/legato/framework/include -I/home/kaiser/legato_framework/legato/build/wp77xx/framework/include -I/home/kaiser/mangOH/samples/Demos/KillSwitch -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/9360366597b53deec561966454cca21e/src -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee/server -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee/server -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/66793a95636118665a3708e58211a86b -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/66793a95636118665a3708e58211a86b -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/66793a95636118665a3708e58211a86b/client -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/66793a95636118665a3708e58211a86b/client -DLE_COMPONENT_NAME=canOpen -DLE_LOG_SESSION=canOpen_LogSession -DLE_LOG_LEVEL_FILTER_PTR=canOpen_LogLevelFilterPtr -Wno-parentheses -fno-strict-aliasing -DPF_CAN=29 -DAF_CAN=PF_CAN -D_COPAPI_EXTERN
/home/kaiser/mangOH/samples/Demos/KillSwitch/canOpen/can_ctrl.c:122:19: error: ‘bit_timing’ defined but not used [-Werror=unused-const-variable=]
static const WORD bit_timing[9] = { // bit-timing table:
^~~~~~~~~~
cc1: all warnings being treated as errors
[8/22] Compiling C++ source
FAILED: /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/f1c62c0f2aa070e692e891414cdb2bcb/obj/74a9e7f5415f3cc33f172b9253959b52.o
/opt/swi/SWI9X06Y_02.32.02.00/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ --sysroot=/opt/swi/y22-ext-wp77xx/sysroots/armv7a-neon-poky-linux-gnueabi -MMD -MF /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/f1c62c0f2aa070e692e891414cdb2bcb/obj/74a9e7f5415f3cc33f172b9253959b52.o.d -Wall -Werror -fvisibility=hidden -c /home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp -o /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/f1c62c0f2aa070e692e891414cdb2bcb/obj/74a9e7f5415f3cc33f172b9253959b52.o -DLE_FILENAME=basename /home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp -DMK_TOOLS_BUILD -DLEGATO_EMBEDDED -fPIC -I /home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx -I/home/kaiser/legato_framework/legato/interfaces -I/home/kaiser/legato_framework/legato/framework/include -I/home/kaiser/legato_framework/legato/build/wp77xx/framework/include -I/home/kaiser/mangOH/samples/Demos/KillSwitch -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/component/f1c62c0f2aa070e692e891414cdb2bcb/src -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/5bf669534557b7b1d0651312ce92c844 -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/5bf669534557b7b1d0651312ce92c844 -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/5bf669534557b7b1d0651312ce92c844/client -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/5bf669534557b7b1d0651312ce92c844/client -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee/client -I/home/kaiser/mangOH/samples/Demos/KillSwitch/_build_killSwitch/wp77xx/api/7d9eb81221abe5f8ee8a5a71ddb65eee/client -DLE_COMPONENT_NAME=killSwitch -DLE_LOG_SESSION=killSwitch_LogSession -DLE_LOG_LEVEL_FILTER_PTR=killSwitch_LogLevelFilterPtr -std=c++11
In file included from /home/kaiser/legato_framework/legato/framework/include/legato.h:188:0,
from /home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:9:
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp: In member function ‘void DemoStateMachine::updateState()’:
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:83:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::DISABLED);
^~~~~~~~
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:83:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::DISABLED);
^~~~~~~~
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:96:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_HOT);
^~~~~~~~
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:96:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_HOT);
^~~~~~~~
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 8 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:109:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_NORMAL);
^~~~~~~~
/home/kaiser/legato_framework/legato/framework/include/le_log.h:530:48: error: format ‘%d’ expects argument of type ‘int’, but argument 9 has type ‘State’ [-Werror=format=]
formatString, ##VA_ARGS);
^
/home/kaiser/legato_framework/legato/framework/include/le_log.h:544:41: note: in expansion of macro ‘_LE_LOG_MSG’
#define LE_DEBUG(formatString, …) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##VA_ARGS)
^~~~~~~~~~~
/home/kaiser/mangOH/samples/Demos/KillSwitch/killSwitch/killSwitch.cpp:109:17: note: in expansion of macro ‘LE_DEBUG’
LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_NORMAL);
^~~~~~~~
cc1plus: all warnings being treated as errors
[9/22] Compiling C source
ninja: build stopped: subcommand failed.
➜ KillSwitch git:(8b4ac33) ✗ git status
HEAD detached at 8b4ac33
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)

modified:   canOpen/Component.cdef

Untracked files:
(use “git add …” to include in what will be committed)

_build_killSwitch/

no changes added to commit (use “git add” and/or “git commit -a”)

Maybe i am simply still too new to legato app programming…

Is anyone out there who is interested as a freelancer to help us out?

How can i turn this off?

Also see: https://forum.mangoh.io/t/killswitch-demo-app/1194

you need to do this:

Developer studio-> Project Properties > C/C++ Build > Settings-> mkapp Tool -> C build option -> Additional compiler option

add “-Wno-error=unused-const-variable=”

Also in killSwitch.cpp, comment out
// LE_DEBUG(“Changing state: %d->%d”, this->_state, State::DISABLED);
// LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_HOT);
// LE_DEBUG(“Changing state: %d->%d”, this->_state, State::OPERATING_NORMAL);