I’m trying to build the Device OS unit tests, as described in user/tests/readme.md
. I’ve installed boost as requested, but after cd user/tests/unit
and make
, I get a number of errors like
../../../user/tests/unit/dcd.cpp:78:13: error: cast from 'const uint8_t*' {aka 'const unsigned char*'} to 'long int' loses precision [-fpermissive]
and
../../../user/tests/unit/dcd.cpp:267:23: error: 'class HippoMocks::MockRepository' has no member named 'ExpectCallFunc'
Is the version of gcc or boost important? The readme makes no comment. I’m on Device OS 2.3.0, Windows, gcc 12.1.0, and boost 1.79.0
also, if I follow the instructions in test/unit_tests/readme.md
, after cmake ..
succeeds, make all test coverage
gives make: *** No rule to make target 'all'. Stop.
When running unit tests, the native compiler must match, at least approximately, the gcc-arm version to build the on-device code. That’s currently 10.2.1, so it’s not surprising that native gcc 12.1 would fail.
Great, thanks. Are there any instructions as to how to set this up? Get gcc straight from ARM or use some prebuilt toolchain? I have been using msys2 but it’s only built for gcc 12
That’s going to be tricky on Windows because you need the native Windows gcc compiler, not the ARM one, to use the gcc platform.
It’s easier on Linux and especially Mac, where you can load different versions of native gcc using Homebrew.