I am trying to understand a bit better how string compression is supposed to work. In particular, I have the feeling that in my nrf-based build, the raw strings are stored in the flash as well as the compressed strings.
For example, if I build like this:
$ pwd
.../circuitpython-dev/ports/nrf
$ make BOARD=pca10059
...
And look for this particular string: https://github.com/adafruit/circuitpython/blob/master/py/lexer.c#L345
$ strings build-pca10059/firmware.bin | grep unicode
unicode name escapes
In de5a9d7, you (@tannewt) said that this happens if you don't have LTO enabled, which completely makes sense. However, when I try to enable LTO (by adding -flto to both CFLAGS and LDFLAGS in the Makefile), I get an executable that doesn't really look valid (on top of taking a really long time to try to link!):
$ make BOARD=pca10059
...
LINK build-pca10059/firmware.elf
text data bss dec hex filename
0 0 2048 2048 800 build-pca10059/firmware.elf
arm-none-eabi-objcopy -O binary build-pca10059/firmware.elf build-pca10059/firmware.bin
arm-none-eabi-objcopy -O ihex build-pca10059/firmware.elf build-pca10059/firmware.hex
Create firmware.uf2
../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-pca10059/firmware.uf2" build-pca10059/firmware.hex
Traceback (most recent call last):
File "../../tools/uf2/utils/uf2conv.py", line 279, in <module>
main()
File "../../tools/uf2/utils/uf2conv.py", line 260, in main
(ext, len(outbuf), appstartaddr))
TypeError: %x format: an integer is required, not NoneType
make: *** [Makefile:274: uf2] Error 1
Is this expected, anything I'm doing wrong?
These are the compiler/linker I'm using:
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arch Repository) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ arm-none-eabi-ld --version
GNU ld (GNU Binutils) 2.31.1
Copyright (C) 2018 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
I am trying to understand a bit better how string compression is supposed to work. In particular, I have the feeling that in my nrf-based build, the raw strings are stored in the flash as well as the compressed strings.
For example, if I build like this:
And look for this particular string: https://github.com/adafruit/circuitpython/blob/master/py/lexer.c#L345
In de5a9d7, you (@tannewt) said that this happens if you don't have LTO enabled, which completely makes sense. However, when I try to enable LTO (by adding
-fltoto bothCFLAGSandLDFLAGSin the Makefile), I get an executable that doesn't really look valid (on top of taking a really long time to try to link!):Is this expected, anything I'm doing wrong?
These are the compiler/linker I'm using: