1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cpu/esp_common: create partitions.csv more robustly

The generated `partitions.csv` needs to state the size of the flash
file. This so far used `ls -l | awk '{print $5}'` to achieve that, but
that is not robust, as the columns of `ls -l` depend on the tool and
system configuration used.

This commit replaces the call with `wc -c`, which should be more robust,
as `wc -c` behavior is POSIX specified.

Co-Authored-By: Karl Fessel <karl.fessel@ml-pa.com>
Co-Authored-By: Benjamin Valentin <benjamin.valentin@ml-pa.com>
This commit is contained in:
Marian Buschsieweke 2025-02-03 11:52:16 +01:00
parent 2416dc3efd
commit 423e5ad690
No known key found for this signature in database
GPG Key ID: 758BD52517F79C41

View File

@ -157,14 +157,16 @@ $(BINDIR)/partitions.csv: $(FLASHFILE)
$(Q)printf "phy_init, data, phy, 0xf000, 0x1000\n" >> $@
$(Q)printf "flashpage, data, phy, $(FLASHPAGE_ADDR_START), $(FLASHPAGE_CAP)\n" >> $@
$(Q)printf "factory, app, factory, $(FLASHFILE_POS), " >> $@
$(Q)ls -l $< | awk '{ print $$5 }' >> $@
# append size of $(FLASHFILE)
$(Q)wc -c < $< >> $@
else
$(BINDIR)/partitions.csv: $(FLASHFILE)
$(Q)printf "\n" > $(BINDIR)/partitions.csv
$(Q)printf "nvs, data, nvs, 0x9000, 0x6000\n" >> $@
$(Q)printf "phy_init, data, phy, 0xf000, 0x1000\n" >> $@
$(Q)printf "factory, app, factory, $(FLASHFILE_POS), " >> $@
$(Q)ls -l $< | awk '{ print $$5 }' >> $@
# append size of $(FLASHFILE)
$(Q)wc -c < $< >> $@
endif
$(BINDIR)/partitions.bin: $(PARTITION_TABLE_CSV)