From abdbf8c9eda99f9eb21a45be4245b5e4c7277992 Mon Sep 17 00:00:00 2001 From: Julian Arevalo Date: Mon, 20 May 2024 09:14:02 +0200 Subject: [PATCH 1/4] lib_cxng: use types with fixed size for portability between 32/64 bit Avoid unit tests errors that are run on x86 64 bit (cherry picked from commit baa266c1dcc421ea6ffbbc535e1ec7c3cdd1d12a) --- include/ox_aes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ox_aes.h b/include/ox_aes.h index b702e368c..f09cf751d 100644 --- a/include/ox_aes.h +++ b/include/ox_aes.h @@ -76,8 +76,8 @@ * @details Such container should be initialized with #cx_aes_init_key_no_throw. */ struct cx_aes_key_s { - size_t size; ///< key size - uint8_t keys[32]; ///< key value + uint32_t size; ///< key size + uint8_t keys[32]; ///< key value }; /** Convenience type. See #cx_aes_key_s. */ typedef struct cx_aes_key_s cx_aes_key_t; From 128b53fde86fd5601eb00fcdacd692527cc08609 Mon Sep 17 00:00:00 2001 From: Julian Arevalo Date: Mon, 20 May 2024 09:15:13 +0200 Subject: [PATCH 2/4] lib_cxng: use types that clearly express their width (cherry picked from commit 989963226717da2ef154661954ed3c5c0381256b) (cherry picked from commit 82f6f52245d8723f15a0071a1e457958cedc3296) --- lib_cxng/include/lcx_cipher.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_cxng/include/lcx_cipher.h b/lib_cxng/include/lcx_cipher.h index e007031e1..415ed58b2 100644 --- a/lib_cxng/include/lcx_cipher.h +++ b/lib_cxng/include/lcx_cipher.h @@ -42,8 +42,8 @@ typedef enum { /** Generic key structure */ typedef struct { - unsigned int size; - unsigned char keys[32]; + uint32_t size; + uint8_t keys[32]; } cipher_key_t; /** Base cipher information */ From 76a211938d12a477cdf724a56ef50875963f61c3 Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Tue, 28 May 2024 09:49:46 +0200 Subject: [PATCH 3/4] Add WEAK attribute to main functions of standard app (cherry picked from commit 8cb7abc061644614ab84e5660e0f45641902ad9b) (cherry picked from commit b8df925c951345ba69788b428eb1f38a5c3592dd) --- lib_standard_app/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_standard_app/main.c b/lib_standard_app/main.c index e82647eac..a04b360e2 100644 --- a/lib_standard_app/main.c +++ b/lib_standard_app/main.c @@ -40,7 +40,7 @@ WEAK void __attribute__((noreturn)) app_exit(void) os_sched_exit(-1); } -static void common_app_init(void) +WEAK void common_app_init(void) { UX_INIT(); @@ -55,7 +55,7 @@ static void common_app_init(void) #endif // HAVE_BLE } -static void standalone_app_main(void) +WEAK void standalone_app_main(void) { #ifdef HAVE_SWAP G_called_from_swap = false; @@ -102,7 +102,7 @@ static void standalone_app_main(void) } #ifdef HAVE_SWAP -static void library_app_main(libargs_t *args) +WEAK void library_app_main(libargs_t *args) { BEGIN_TRY { @@ -152,7 +152,7 @@ static void library_app_main(libargs_t *args) } #endif // HAVE_SWAP -__attribute__((section(".boot"))) int main(int arg0) +WEAK __attribute__((section(".boot"))) int main(int arg0) { // exit critical section __asm volatile("cpsie i"); From 325c7080587424fffdaa23ff200e5bbfaf3d5514 Mon Sep 17 00:00:00 2001 From: Xavier Chapron Date: Fri, 17 May 2024 14:20:20 +0200 Subject: [PATCH 4/4] script.ld: Fix LNX and LNSP SRAM size (cherry picked from commit e502be105bbfb67ea964b992fd1b2a653b62dca3) --- target/nanos2/script.ld | 2 +- target/nanox/script.ld | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/nanos2/script.ld b/target/nanos2/script.ld index c775ab1f0..94b0b2e18 100644 --- a/target/nanos2/script.ld +++ b/target/nanos2/script.ld @@ -26,7 +26,7 @@ MEMORY FLASH (rx) : ORIGIN = 0xc0de0000, LENGTH = 400K DATA (r) : ORIGIN = 0xc0de0000, LENGTH = 400K - SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 30K + SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 44K } PAGE_SIZE = 512; diff --git a/target/nanox/script.ld b/target/nanox/script.ld index 44cd6d66f..cfca329f1 100644 --- a/target/nanox/script.ld +++ b/target/nanox/script.ld @@ -26,7 +26,7 @@ MEMORY FLASH (rx) : ORIGIN = 0xc0de0000, LENGTH = 400K DATA (r) : ORIGIN = 0xc0de0000, LENGTH = 400K - SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 30K + SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 28K } PAGE_SIZE = 256;