Re: Device driver configuration and driver_data distinction.

Andy Ross

Marcus Shawcroft wrote (on Thursday, October 06, 2016 3:18AM):
This design make sense from the perspective that the read only config
data *could* be const and placed in flash only, hence lowering
pressure on sram.

However, it is not possible to make a drivers config structure const
because include/device.h defines struct device_config with a non const
Actually it goes into the ROM data section anyway, despite the lack of
const. This is controlled in device.h by declaring the device_config
struct to be in the "devconfig.init" section. This then is placed by
the linker script (one per arhicecture right now, sigh) into the
ROMable region, right before the compiler-managed .rodata (which of
course *is* the stuff that depends on const).

The lack of const is (well, should be) just a missed opportunity for
compiler warnings. But AFAICT it's wrong and should be fixed.


Join to automatically receive all group messages.