The example below demonstrates the problem. a1 which is a static object is not initialized by the constructor (bad) while a2 is (good).
Is this expected, or a matter of a misconfigured compiler?
class A {
public:
A(int val): val_(val) {}
int val_;
};
A a1(11);
void main(void) {
A a2(22);
printk("a1.val_=%d, a2.val_=%d\n", a1.val_, a2.val_);
}
Printed output:
a1.val_=0, a2.val_=22
My platformio.io:
[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = zephyr
debug_tool = jlink
monitor_speed = 115200
monitor_port = COM7
debug_build_flags = -O0 -g -ggdb
build_flags =
-I .pio/build/nrf52_dk/zephyr/include/generated
extra_scripts = extra_script.py