micro-ecc icon indicating copy to clipboard operation
micro-ecc copied to clipboard

An avr assemble fix for Issue #154

Open L1uTongweiNewAccount opened this issue 2 years ago • 3 comments

Yesterday, I am trying to compile the micro-ecc in MCU atmega328p (avr mcu) when uECC_OPTIMIZATION_LEVEL=4.

But I got an error about too long assembler code.

So I edit the code to split them in some process.

I know it will reduce the speed, but it's better than nothing.

L1uTongweiNewAccount avatar Feb 19 '24 12:02 L1uTongweiNewAccount

This is an example when I am using uECC_OPTIMIZATION_LEVEL=4 (Running examples/ecc_test/ecc_test.ino):

20:25:52.404 -> Testing ecc
20:25:53.572 -> Made key 1 in 1171
20:25:54.655 -> Made key 2 in 1066
20:25:55.726 -> Shared secret 1 in 1063
20:25:56.754 -> Shared secret 2 in 1066
20:25:56.754 -> Shared secrets are identical

The test finals in 4.35s.

And this is an example when I am using uECC_OPTIMIZATION_LEVEL=2:

20:35:04.517 -> Testing ecc
20:35:05.638 -> Made key 1 in 1127
20:35:06.807 -> Made key 2 in 1183
20:35:07.875 -> Shared secret 1 in 1074
20:35:08.949 -> Shared secret 2 in 1068
20:35:08.949 -> Shared secrets are identical

This process finals in 4.432s.

L1uTongweiNewAccount avatar Feb 19 '24 12:02 L1uTongweiNewAccount

I think the optimize -Os reduces the optimiztion.

So I use -Ofast, and got:

21:01:31.967 -> Testing ecc
21:01:32.756 -> Made key 1 in 791
21:01:33.362 -> Made key 2 in 632
21:01:33.968 -> Shared secret 1 in 583
21:01:34.529 -> Shared secret 2 in 580
21:01:34.529 -> Shared secrets are identical

only 2.562s!

L1uTongweiNewAccount avatar Feb 19 '24 13:02 L1uTongweiNewAccount

@aeruder can you merge this or check it? this is a good PR for avr platform.

L1uTongweiNewAccount avatar Jul 04 '24 12:07 L1uTongweiNewAccount