pkg/semtech-loramac: add eepreg support
Contribution description
This pull-request makes the semtech-loramac package utilize the sys_eepreg module to figure out where to store it's configuration if it's loaded. If it's not loaded but eeprom is, then it does as before. To avoid code duplication, i've changed the functions that interact with EEPROM to take a pos parameter. This parameter is then either defined by a macro, if ´sys_eepreg´ isn't used, or by sys_eepreg if it is used.
uncrustify went a bit crazy with the indentation in ´semtech_loramac.c´ so this pull-request seems larger than it is
Testing procedure
reuse the same test as already used by semtech-loramac, but include the ´sys_eepreg´ module to check that it saves and loads information as expected.
Unfortunately I haven't got a functioning gateway near me, but will have access to one next week.
Issues/PRs references
Running the automatic test in semtech-loramac on IoTLAB gives the following output where it fails on the second abp test for some reason. This is consistent with the behavior before the change
EEPREG
60432 248 6884 67564 107ec /home/flapkap/RIOT-flapkap/tests/pkg/semtech-loramac/bin/b-l072z-lrwan1/tests_semtech-loramac.elf
iotlab-node --jmespath='keys(@)[0]' --format='lambda ret: exit(int(ret))' --list saclay,st-lrwan1,10 --flash /home/flapkap/RIOT-flapkap/tests/pkg/semtech-loramac/bin/b-l072z-lrwan1/tests_semtech-loramac.bin
ssh -t [email protected] 'socat - tcp:st-lrwan1-10.saclay.iot-lab.info:20000'
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac erase
>
> loramac erase
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
> loramac set dr 0
loramac set dr 0
> loramac join otaa
loramac join otaa
Join procedure succeeded!
>loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
>loramac set dr 3
loramac set dr 3
> loramac join otaa
loramac join otaa
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
> loramac set dr 5
loramac set dr 5
> loramac join otaa
loramac join otaa
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac erase
loramac erase
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac set deveui 70B3D57ED0063E71
loramac set deveui 70B3D57ED0063E71
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set devaddr 260BC475
loramac set devaddr 260BC475
> loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
> loramac set appskey 1F90B525820ADA25D6667998DDA95628
loramac set appskey 1F90B525820ADA25D6667998DDA95628
> loramac set rx2_dr 0
loramac set rx2_dr 0
> loramac set dr 0
loramac set dr 0
> loramac join abp
loramac join abp
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
The Network Server has pending data
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> loramac get ul_cnt
loramac get ul_cnt
Uplink Counter: 2
> reboot
reboot
main(): This is RIOT! (Version: 7f0bd)
All up, running the shell now
> loramac set ul_cnt 2
loramac set ul_cnt 2
> loramac set deveui 70B3D57ED0063E71
loramac set deveui 70B3D57ED0063E71
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set devaddr 260BC475
loramac set devaddr 260BC475
> loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
> loramac set appskey 1F90B525820ADA25D6667998DDA95628
loramac set appskey 1F90B525820ADA25D6667998DDA95628
> loramac set rx2_dr 0
loramac set rx2_dr 0
>loramac set dr 3
loramac set dr 3
> loramac join abp
loramac join abp
Join procedure succeeded!
>loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Timeout in expect script at "child.expect_exact("Received ACK from network", timeout=30)" (tests/pkg/semtech-loramac/tests-with-config/01-run.py:107)
release 2023.10
text data bss dec hex filename
59724 248 6884 66856 10528 /home/flapkap/RIOT/tests/pkg/semtech-loramac/bin/b-l072z-lrwan1/tests_semtech-loramac.elf
iotlab-node --jmespath='keys(@)[0]' --format='lambda ret: exit(int(ret))' --list saclay,st-lrwan1,10 --flash /home/flapkap/RIOT/tests/pkg/semtech-loramac/bin/b-l072z-lrwan1/tests_semtech-loramac.bin
ssh -t [email protected] 'socat - tcp:st-lrwan1-10.saclay.iot-lab.info:20000'
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac erase
>
> loramac erase
>reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
> loramac set dr 0
loramac set dr 0
> loramac join otaa
loramac join otaa
Join procedure succeeded!
>loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
> loramac set dr 3
loramac set dr 3
> loramac join otaa
loramac join otaa
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
>loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
>loramac set deveui 70B3D57ED005EA59
loramac set deveui 70B3D57ED005EA59
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
>loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
loramac set appkey 385794DDE70CE2EAB5B5B12A4807822C
> loramac set dr 5
loramac set dr 5
> loramac join otaa
loramac join otaa
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
Message sent with success
> loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac erase
loramac erase
> reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac set deveui 70B3D57ED0063E71
loramac set deveui 70B3D57ED0063E71
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set devaddr 260BC475
loramac set devaddr 260BC475
>loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
> loramac set appskey 1F90B525820ADA25D6667998DDA95628
loramac set appskey 1F90B525820ADA25D6667998DDA95628
> loramac set rx2_dr 0
loramac set rx2_dr 0
> loramac set dr 0
loramac set dr 0
> loramac join abp
loramac join abp
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Received ACK from network
The Network Server has pending data
Message sent with success
>loramac tx "This is RIOT" uncnf 42
loramac tx "This is RIOT" uncnf 42
Message sent with success
> loramac get ul_cnt
loramac get ul_cnt
Uplink Counter: 2
> reboot
reboot
main(): This is RIOT! (Version: 2023.10)
All up, running the shell now
> loramac set ul_cnt 2
loramac set ul_cnt 2
>loramac set deveui 70B3D57ED0063E71
loramac set deveui 70B3D57ED0063E71
> loramac set appeui 0000000000000000
loramac set appeui 0000000000000000
> loramac set devaddr 260BC475
loramac set devaddr 260BC475
> loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
loramac set nwkskey 5D785E33AE6A43C436D27F813ECAF919
> loramac set appskey 1F90B525820ADA25D6667998DDA95628
loramac set appskey 1F90B525820ADA25D6667998DDA95628
> loramac set rx2_dr 0
loramac set rx2_dr 0
>loramac set dr 3
loramac set dr 3
> loramac join abp
loramac join abp
Join procedure succeeded!
> loramac tx "This is RIOT" cnf 123
loramac tx "This is RIOT" cnf 123
Timeout in expect script at "child.expect_exact("Received ACK from network", timeout=30)" (tests/pkg/semtech-loramac/tests-with-config/01-run.py:107)
make: *** [/home/flapkap/RIOT/makefiles/tests/tests.inc.mk:70: test-with-config] Error 1
make: Leaving directory '/home/flapkap/RIOT/tests/pkg/semtech-loramac