From 21d2becd6bc5b19db54cbe41bbcf2fc78e088abc Mon Sep 17 00:00:00 2001 From: Michael Shihrer Date: Fri, 24 Feb 2017 15:47:28 -0700 Subject: [PATCH] Modified settings.h to allow building on KSDK 1.3, modified test.c and benchmark.c to work with KSDK, added KDS project for building wolfSSL for Hexiwear --- .gitignore | 4 + IDE/HEXIWEAR/wolfSSL_HW/.cproject | 143 ++++++++++++++++++ .../wolfSSL_HW/.cwGeneratedFileSetLog | 19 +++ IDE/HEXIWEAR/wolfSSL_HW/.project | 50 ++++++ ...freescale.processorexpert.derivative.prefs | 2 + IDE/HEXIWEAR/wolfSSL_HW/user_settings.h | 6 + wolfcrypt/benchmark/benchmark.c | 12 ++ wolfcrypt/test/test.c | 4 + wolfssl/wolfcrypt/settings.h | 64 ++++---- 9 files changed, 278 insertions(+), 26 deletions(-) create mode 100644 IDE/HEXIWEAR/wolfSSL_HW/.cproject create mode 100644 IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog create mode 100644 IDE/HEXIWEAR/wolfSSL_HW/.project create mode 100644 IDE/HEXIWEAR/wolfSSL_HW/.settings/com.freescale.processorexpert.derivative.prefs create mode 100644 IDE/HEXIWEAR/wolfSSL_HW/user_settings.h diff --git a/.gitignore b/.gitignore index f1fd0c9c9..d29d12b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -190,4 +190,8 @@ wrapper/CSharp/x64/ # Visual Studio Code Workspace Files *.vscode + IDE/INTIME-RTOS/Debug_* + +# Hexiwear +IDE/HEXIWEAR/wolfSSL_HW/Debug diff --git a/IDE/HEXIWEAR/wolfSSL_HW/.cproject b/IDE/HEXIWEAR/wolfSSL_HW/.cproject new file mode 100644 index 000000000..72574db96 --- /dev/null +++ b/IDE/HEXIWEAR/wolfSSL_HW/.cproject @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog b/IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog new file mode 100644 index 000000000..8d1a66f61 --- /dev/null +++ b/IDE/HEXIWEAR/wolfSSL_HW/.cwGeneratedFileSetLog @@ -0,0 +1,19 @@ +Sources/main.c +Project_Settings/Linker_Files/MK64FN1M0xxx12_flash.ld +SDK/platform/CMSIS/Include/core_cmSimd.h +SDK/platform/devices/MK64F12/include/MK64F12.h +SDK/platform/CMSIS/Include/arm_common_tables.h +SDK/platform/CMSIS/Include/arm_const_structs.h +SDK/platform/devices/MK64F12/include/MK64F12_features.h +SDK/platform/CMSIS/Include/core_cm4.h +SDK/platform/CMSIS/Include/core_cmFunc.h +SDK/platform/CMSIS/Include/core_cmInstr.h +SDK/platform/devices/fsl_device_registers.h +SDK/platform/devices/MK64F12/include/fsl_bitaccess.h +SDK/platform/CMSIS/Include/arm_math.h +SDK/platform/devices/MK64F12/include/MK64F12_extension.h +Project_Settings/Startup_Code/startup.c +Project_Settings/Startup_Code/system_MK64F12.c +Project_Settings/Startup_Code/startup.h +Project_Settings/Startup_Code/startup_MK64F12.S +Project_Settings/Startup_Code/system_MK64F12.h \ No newline at end of file diff --git a/IDE/HEXIWEAR/wolfSSL_HW/.project b/IDE/HEXIWEAR/wolfSSL_HW/.project new file mode 100644 index 000000000..a752f1d7b --- /dev/null +++ b/IDE/HEXIWEAR/wolfSSL_HW/.project @@ -0,0 +1,50 @@ + + + wolfSSL_HW + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + src + 2 + $%7BPARENT-3-PROJECT_LOC%7D/src + + + wolfcrypt + 2 + $%7BPARENT-3-PROJECT_LOC%7D/wolfcrypt + + + wolfssl + 2 + $%7BPARENT-3-PROJECT_LOC%7D/wolfssl + + + + + PROJECT_KSDK_PATH + file:/home/michael/Work/.KSDK_1.3.0 + + + diff --git a/IDE/HEXIWEAR/wolfSSL_HW/.settings/com.freescale.processorexpert.derivative.prefs b/IDE/HEXIWEAR/wolfSSL_HW/.settings/com.freescale.processorexpert.derivative.prefs new file mode 100644 index 000000000..60d5016ea --- /dev/null +++ b/IDE/HEXIWEAR/wolfSSL_HW/.settings/com.freescale.processorexpert.derivative.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +versionGenerated/versionGenerated=1.0.0.RT7_b1550-0615 diff --git a/IDE/HEXIWEAR/wolfSSL_HW/user_settings.h b/IDE/HEXIWEAR/wolfSSL_HW/user_settings.h new file mode 100644 index 000000000..664900957 --- /dev/null +++ b/IDE/HEXIWEAR/wolfSSL_HW/user_settings.h @@ -0,0 +1,6 @@ +#define FREESCALE_KSDK_BM +#define FREESCALE_KSDK_1_3 +#define FSL_HW_CRYPTO_MANUAL_SELECTION +#define NO_MAIN_DRIVER +#define USE_CERT_BUFFERS_1024 +#define ECC_USER_CURVES diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 140865bfa..0b4096ccc 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -52,6 +52,11 @@ #else #include #endif +#elif defined(FREESCALE_KSDK_BM) + #include "fsl_debug_console.h" + #include "fsl_os_abstraction.h" + #undef printf + #define printf PRINTF #else #include #endif @@ -2656,6 +2661,13 @@ void bench_ed25519KeySign(void) return (double)tv.SECONDS + (double)tv.MILLISECONDS / 1000; } +#elif defined(FREESCALE_KSDK_BM) + + double current_time(int reset) + { + return (double)OSA_TimeGetMsec() / 1000; + } + #elif defined(WOLFSSL_EMBOS) #include "RTOS.h" diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 15c5a6783..3d356c712 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -163,6 +163,10 @@ #else #include #endif +#elif defined(FREESCALE_KSDK_BM) + #include "fsl_debug_console.h" + #undef printf + #define printf PRINTF #else #include #endif diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 6580338ce..822b89940 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -367,7 +367,7 @@ #define USE_CERT_BUFFERS_2048 /* uTasker port uses RAW sockets, use I/O callbacks - * See wolfSSL uTasker example for sample callbacks */ + * See wolfSSL uTasker example for sample callbacks */ #define WOLFSSL_USER_IO /* uTasker filesystem not ported */ @@ -421,26 +421,26 @@ #endif #ifdef WOLFSSL_NRF5x - #define SIZEOF_LONG 4 - #define SIZEOF_LONG_LONG 8 - #define NO_ASN_TIME - #define NO_DEV_RANDOM - #define NO_FILESYSTEM - #define NO_MAIN_DRIVER - #define NO_WRITEV - #define SINGLE_THREADED - #define USE_FAST_MATH - #define TFM_TIMING_RESISTANT - #define USE_WOLFSSL_MEMORY - #define WOLFSSL_NRF51 - #define WOLFSSL_USER_IO - #define NO_SESSION_CACHE + #define SIZEOF_LONG 4 + #define SIZEOF_LONG_LONG 8 + #define NO_ASN_TIME + #define NO_DEV_RANDOM + #define NO_FILESYSTEM + #define NO_MAIN_DRIVER + #define NO_WRITEV + #define SINGLE_THREADED + #define USE_FAST_MATH + #define TFM_TIMING_RESISTANT + #define USE_WOLFSSL_MEMORY + #define WOLFSSL_NRF51 + #define WOLFSSL_USER_IO + #define NO_SESSION_CACHE #endif /* Micrium will use Visual Studio for compilation but not the Win32 API */ #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && \ - !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \ - !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS) + !defined(FREERTOS_TCP) && !defined(EBSNET) && !defined(WOLFSSL_EROAD) && \ + !defined(WOLFSSL_UTASKER) && !defined(INTIME_RTOS) #define USE_WINDOWS_API #endif @@ -759,7 +759,9 @@ extern void uITRON4_free(void *p) ; #define WOLFSSL_USER_IO #define SINGLE_THREADED #define NO_FILESYSTEM - #define USER_TICKS + #ifndef TIME_OVERRIDES + #define USER_TICKS + #endif #endif /* FREESCALE_KSDK_BM */ #ifdef FREESCALE_COMMON @@ -800,14 +802,24 @@ extern void uITRON4_free(void *p) ; #define WOLFSSL_AES_DIRECT #endif - #include "fsl_common.h" + #ifdef FREESCALE_KSDK_1_3 + #include "fsl_device_registers.h" + #else + #include "fsl_common.h" + #endif /* random seed */ #define NO_OLD_RNGNAME #if defined(FSL_FEATURE_SOC_TRNG_COUNT) && (FSL_FEATURE_SOC_TRNG_COUNT > 0) #define FREESCALE_KSDK_2_0_TRNG #elif defined(FSL_FEATURE_SOC_RNG_COUNT) && (FSL_FEATURE_SOC_RNG_COUNT > 0) - #define FREESCALE_KSDK_2_0_RNGA + #ifdef FREESCALE_KSDK_1_3 + #include "fsl_rnga_driver.h" + #define FREESCALE_RNGA + #define RNGA_INSTANCE (0) + #else + #define FREESCALE_KSDK_2_0_RNGA + #endif #elif !defined(FREESCALE_KSDK_BM) && !defined(FREESCALE_FREE_RTOS) && !defined(FREESCALE_KSDK_FREERTOS) #define FREESCALE_RNGA #define RNGA_INSTANCE (0) @@ -948,9 +960,9 @@ extern void uITRON4_free(void *p) ; #define NO_OLD_RNGNAME #ifdef WOLFSSL_STM32_CUBEMX #include "stm32f2xx_hal.h" - #ifndef STM32_HAL_TIMEOUT - #define STM32_HAL_TIMEOUT 0xFF - #endif + #ifndef STM32_HAL_TIMEOUT + #define STM32_HAL_TIMEOUT 0xFF + #endif #else #include "stm32f2xx.h" #include "stm32f2xx_cryp.h" @@ -974,9 +986,9 @@ extern void uITRON4_free(void *p) ; #endif #ifdef WOLFSSL_STM32_CUBEMX #include "stm32f4xx_hal.h" - #ifndef STM32_HAL_TIMEOUT - #define STM32_HAL_TIMEOUT 0xFF - #endif + #ifndef STM32_HAL_TIMEOUT + #define STM32_HAL_TIMEOUT 0xFF + #endif #else #include "stm32f4xx.h" #include "stm32f4xx_cryp.h"