Hi Gunar,

Even though these static const arrays are allocated in the .rodata
segment, they are allocated in each module that includes `board.h`. XFAs
addresses this problem.


So you are saying that the data gets duploicated in ROM several times? I did not know that. If that is the case, then it's definitely a bad thing!

For ESP32-Boards I tried another approach. In `periph_conf.h` there is
only a declaration of an external const variable `pwm_dev_num` which
contains the number of PWM devices and the macro `PWM_NUMOF` is then
defined as follows:

```
extern const unsigned pwm_dev_num;
#define PWM_NUMOF   (pwm_dev_num)
```


Regardless of ROM duplication or not, I think you approach is much better and cleaner. Also, you don't bloat the header, and don't have the compiler parse the same definitions several times. I see no reasons to define the array in the header file.

Regards,

Juan.
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to