Closed panevain closed 7 months ago
The armv6m_lowsize implementation is highly optimized and forces the compiler to keep the Ascon state inside CPU registers. This results in some constraints which cannot be met all the time. A similar performant, but less constraint implementation is opt32_lowsize.
In my case, the armv6m_lowsize implementation compiles for Cortex-M0 if I add -O2 -fomit-frame-pointer
to the gcc options:
arm-none-eabi-gcc -mcpu=cortex-m0 -O2 -fomit-frame-pointer -Itests -Icrypto_aead/ascon128av12/armv6m_lowsize crypto_aead/ascon128av12/armv6m_lowsize/*.[cS] -c
Others work as well but -Os
does not seem to work for Cortex-M0. What exact processor do you compile for?
I'm attempting to compile for the Arduino Nano 33 IoT which has a Microchip SAMD21G18A processor.
Did my command work to compile the code? Also try with -mcpu=cortex-m0
removed or -mcpu=cortex-m0plus
added.
Yes, switching from -Os
to -O2
allows the code to compile.
All else being equal, switching from the opt32_lowsize
round function with -Os
enabled to the amrv6m_lowsize
round function with -O2
enabled increases the size of the binary by 78 bytes.
I'm still confused as to why the -Os
flag breaks the assembly, but for now, this is a good solution.
Thank you Martin!
Yes, I'm also confused why -Os breaks the assembly.
Another option is to compile permutations.c using -O2 and the other files using -Os.
Great idea. I'll give that a run.
Closing the issue due to a workaround being found.
Hello,
I am attempting to build the Ascon-128a
armv6m_lowsize
implementation and I am encountering an issue with the assembly inround.h
.The following commands cause the issue to appear:
Build output:
The same error arises when compiling using
arm-none-eabi-g++
(from thearduino-cli
tooling). I've read the GCC ASM constraints documentation and I believe that the assembly provided should work, and I'm confused why it doesn't.Through trial and error, I've determined that having more than one output register marked with the
h
constraint causes compilation to fail.Machine information:
Any help/ideas would be appreciated!
Matt