From e242d3eea36935df60be6f7275db86512b222e5d Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 7 Oct 2015 14:55:34 +0900 Subject: [PATCH] Change project name cyassl to wolfssl --- .../Projects/wolfSSL-Full/Abstract.txt | 85 ++ IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c | 128 +++ IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c | 697 +++++++++++++ .../Projects/wolfSSL-Full/time-CortexM3-4.c | 43 + .../Projects/wolfSSL-Full/wolfsslFull.uvoptx | 387 +++++++ .../Projects/wolfSSL-Full/wolfsslFull.uvprojx | 950 ++++++++++++++++++ 6 files changed, 2290 insertions(+) create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt b/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt new file mode 100644 index 000000000..dde67ce4f --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt @@ -0,0 +1,85 @@ +This program gives wolfCrypt and CyaSSL library demo. + +In order to run the demo, +Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. +For demo configuration, refer config-Crypt.h and config-CyaSSL.h. + +After download and start the execution, you can type in commands through the +Debug(printf) viewer. + +test wolfCrypt Simple test suite +benchmark wolfCrypt Simple benchmark +server& simple server in background mode +client simple client +echoserver& echo server in background mode +echoclient echo client +server/client -h help for server/client command + + +=== Typical Command Usage Scenario === + +Starting Shell +>test +MD5 test passed! +MD4 test passed! +SHA test passed! +... + +>benchmark +AES 25 kB took 0.025 seconds, 0.96 MB/s +ARC4 25 kB took 0.006 seconds, 3.83 MB/s +... + +DH 2048 key agreement 685.93 milliseconds, avg over 1 iterations + +>echoserver& +"echoserver" is running with the background mode. + +>echoclient +ABCDEFG +ABCDEFG +WXYZ +WXYZ +quit +sending server shutdown command: quit! +client sent quit command: shutting down! + +>server& +"server" is running with the background mode. + +>client +peer's cert info: + issuer : /C=... + subject: /C=... + serial number:02 +SSL version is TLSv1.2 +SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 +peer's cert info: + issuer : /C=... + subject: /C=... + serial number:... +SSL version is TLSv1.2 +SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 +Client message: hello cyassl! +Server response: I hear you fa shizzle! + +>client -h 192.168.2.100 -p 443 -g -v 0 +peer's cert info: + issuer : /CN=... + subject: /CN=... + serial number:44:39:... +SSL version is SSLv3 +SSL cipher suite is SSL_RSA_WITH_RC4_128_SHA +SSL connect ok, sending GET... +... +=== + +For the hardware crypt on config-Crypt.h, download +STSW-STM32062: STM32F2xx standard peripherals library at +http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to + {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib + + +Support +------- +Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c new file mode 100644 index 000000000..2ee3de735 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c @@ -0,0 +1,128 @@ +/* main.c + * + * Copyright (C) 2006-2015 wolfSSL Inc. + * + * This file is part of wolfSSL. (formerly known as CyaSSL) + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#include +#include +#define __CORTEX_M3__ + +#include +#include "wolfcrypt/src/misc.c" +#include "stm32f2xx_hal.h" +#include "cmsis_os.h" +#include "rl_net.h" +#include + +#include + + +/*----------------------------------------------------------------------------- + * Initialize Clock Configuration + *----------------------------------------------------------------------------*/ +void SystemClock_Config(void) { + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* Enable HSE Oscillator and activate PLL with HSE as source */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 25; + RCC_OscInitStruct.PLL.PLLN = 240; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 5; + HAL_RCC_OscConfig(&RCC_OscInitStruct); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + clocks dividers */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | + RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3); +} + +/*----------------------------------------------------------------------------- + * Initialize a Flash Memory Card + *----------------------------------------------------------------------------*/ +#if !defined(NO_FILESYSTEM) +#include "rl_fs.h" +static void init_filesystem (void) { + int32_t retv; + + retv = finit ("M0:"); + if (retv == 0) { + retv = fmount ("M0:"); + if (retv == 0) { + printf ("Drive M0 ready!\n"); + } + else { + printf ("Drive M0 mount failed!\n"); + } + } + else { + printf ("Drive M0 initialization failed!\n"); + } +} +#endif + +typedef struct func_args { + int argc; + char** argv; +} func_args; + + +extern void shell_main(func_args * args) ; + +/*----------------------------------------------------------------------------- + * mian entry + *----------------------------------------------------------------------------*/ +int myoptind = 0; +char* myoptarg = NULL; + +int main() +{ + void *arg = NULL ; + + SystemClock_Config() ; + #if !defined(NO_FILESYSTEM) + init_filesystem (); + #endif + + netInitialize() ; + osDelay(300) ; + + #if defined(DEBUG_WOLFSSL) + printf("Turning ON Debug message\n") ; + wolfSSL_Debugging_ON() ; + #endif + + shell_main(arg) ; + +} diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c new file mode 100644 index 000000000..f9550c2a6 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c @@ -0,0 +1,697 @@ +/*shell.c + * + * Copyright (C) 2006-2015 wolfSSL Inc. + * + * This file is part of wolfSSL. (formerly known as CyaSSL) + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + /*** tiny Shell for wolfSSL apps ***/ + + #ifdef HAVE_CONFIG_H + #include +#endif + + +#include "wolfssl/internal.h" +#include + +#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + #include + #include + #include + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) + #include "cmsis_os.h" + #include "rl_fs.h" + #else + #include + #endif +#endif + +#ifdef WOLFSSL_KEIL_TCP_NET +#include "wolfssl/test.h" +#else +typedef struct func_args { + int argc; + char** argv; + int return_code; +} func_args; +#endif + +#if defined(WOLFSSL_CMSIS_RTOS) +#define HAVE_KEIL_RTX +#endif + +#ifdef NO_ECHOCLIENT +#define echoclient_test command_not_found +#endif +#ifdef NO_ECHOSERVER +#define echoserver_test command_not_found +#endif +#ifdef NO_SIMPLE_CLIENT +#define client_test command_not_found +#endif +#ifdef NO_SIMPLE_SERVER +#define server_test command_not_found +#endif +#ifdef NO_CRYPT_BENCHMARK +#define benchmark_test command_not_found +#endif +#ifdef NO_CRYPT_TEST +#define ctaocrypt_test command_not_found +#endif + +#ifndef WOLFSSL_KEIL_TCP_NET +#define ipaddr_comm command_not_found +#endif + +#if !defined(HAVE_KEIL_RTX) +#define stack_comm command_not_found +#endif + + +#if !defined(DEBUG_WOLFSSL) +#define dbg_comm command_not_found +#endif + + +void command_not_found(void *argv) { + printf("Command not found\n") ; +} + +extern void echoclient_test(void *args) ; +extern void echoserver_test(void *args) ; +extern void benchmark_test(void *args) ; +extern void wolfcrypt_test(void *args) ; +extern void client_test(void *args) ; +extern void server_test(void *args) ; +extern void kill_task(void *args) ; +extern void ipaddr_comm(void *args) ; +extern void stack_comm(void *args) ; +extern void for_command(void *args) ; +extern void dbg_comm(void *arg) ; +extern void help_comm(void *arg) ; + +#if !defined(NO_CRYPT_TEST) + +#ifndef NO_MD5 +extern void md5_test(void *arg) ; +#endif +#ifdef WOLFSSL_MD2 +extern void md2_test(void *arg) ; +#endif +#ifndef NO_MD4 +extern void md4_test(void *arg) ; +#endif + +extern void sha_test(void *arg) ; + +#ifndef NO_SHA256 +extern void sha256_test(void *arg) ; +#endif +#ifdef WOLFSSL_SHA384 +extern void sha384_test(void *arg) ; +#endif + +#ifdef WOLFSSL_SHA512 +extern void sha512_test(void *arg) ; +#endif + +#ifdef WOLFSSL_RIPEMD +extern void ripemd_test(void *arg) ; +#endif +#ifndef NO_HMAC + #ifndef NO_MD5 +extern void hmac_md5_test(void *arg) ; + #endif +extern void hmac_sha_test(void *arg) ; + + #ifndef NO_SHA256 +extern void hmac_sha256_test(void *arg) ; + #endif + + #ifdef WOLFSSL_SHA384 +extern void hmac_sha384_test(void *arg) ; + #endif +#endif +#ifndef NO_RC4 +extern void arc4_test(void *arg) ; +#endif + +#ifndef NO_HC128 +extern void hc128_test(void *arg) ; +#endif + +#ifndef NO_RABBIT +extern void rabbit_test(void *arg) ; +#endif + +#ifndef NO_DES3 +extern void des_test(void *arg) ; +extern void des3_test(void *arg) ; +#endif + +#ifndef NO_AES +extern void aes_test(void *arg) ; +#ifdef HAVE_AESGCM +extern void aesgcm_test(void *arg) ; +#endif + +#ifdef HAVE_AESCCM +extern void aesccm_test(void *arg) ; +#endif +#endif + +#ifdef HAVE_CAMELLIA +extern void camellia_test(void *arg) ; +#endif +extern void random_test(void *arg) ; + +#ifndef NO_RSA +extern void rsa_test(void *arg) ; +#endif + +#ifndef NO_DH +extern void dh_test(void *arg) ; +#endif + +#ifndef NO_DSA +extern void dsa_test(void *arg) ; +#endif + +#ifndef NO_PWDBASED +extern void pwdbased_test(void *arg) ; +#endif + +#ifdef OPENSSL_EXTRA +extern void openssl_test(void *arg) ; +#endif + +#ifdef HAVE_ECC +extern void ecc_test(void *arg) ; +#endif + +#endif /* NO_CRYPT_TEST */ + +static struct { + const char *command ; + void (*func)(void *args) ; +} commandTable[] = { + "echoclient", echoclient_test, + "echoserver", echoserver_test, + "benchmark", benchmark_test, + "test", wolfcrypt_test, + "client", client_test, + "server", server_test, + "ipaddr", ipaddr_comm, /* TBD */ + "stack", stack_comm, /* On/Off check stack size */ + "for", for_command, /* iterate next command X times */ + "debug", dbg_comm, /* On/Off debug message */ + "help", help_comm, /* Breif description about the commands */ + + /** short name **/ + "ec", echoclient_test, + "es", echoserver_test, + "bm", benchmark_test, + "te", wolfcrypt_test, + "cl", client_test, + "sv", server_test, + "ip", ipaddr_comm, + "st", stack_comm, + "dbg", dbg_comm, + "?", help_comm, + +/*** test suites ****/ +#if !defined(NO_CRYPT_TEST) +#ifndef NO_MD5 + "md5", md5_test, +#endif +#ifdef WOLFSSL_MD2 + "md2", md2_test, +#endif +#ifndef NO_MD4 + "md4", md4_test, +#endif + "sha", sha_test, +#ifndef NO_SHA256 + "sha256", sha256_test, +#endif +#ifdef WOLFSSL_SHA384 + "sha384", sha384_test, +#endif +#ifdef WOLFSSL_SHA512 + "sha512", sha512_test, +#endif +#ifdef WOLFSSL_RIPEMD + "ripemd", ripemd_test, +#endif +#ifndef NO_HMAC + #ifndef NO_MD5 + "hmac_md5", hmac_md5_test, + #endif + "hmac_sha", hmac_sha_test, + #ifndef NO_SHA256 + "hmac_sha256", hmac_sha256_test, + #endif + #ifdef WOLFSSL_SHA384 + "hmac_sha384", hmac_sha384_test, + #endif +#endif +#ifndef NO_RC4 + "arc4", arc4_test, +#endif +#ifndef NO_HC128 + "hc128", hc128_test, +#endif +#ifndef NO_RABBIT + "rabbit", rabbit_test, +#endif +#ifndef NO_DES3 + "des", des_test, + "des3", des3_test, +#endif +#ifndef NO_AES + "aes", aes_test, + #ifdef HAVE_AESGCM + "aesgcm", aesgcm_test, + #endif + #ifdef HAVE_AESCCM + "aesccm", aesccm_test, + #endif +#endif + +#ifdef HAVE_CAMELLIA + "camellia", camellia_test, +#endif + "random", random_test, +#ifndef NO_RSA + "rsa", rsa_test, +#endif +#ifndef NO_DH + "dh", dh_test, +#endif +#ifndef NO_DSA + "dsa", dsa_test, +#endif +#ifndef NO_PWDBASED + "pwdbased", pwdbased_test, +#endif +#ifdef OPENSSL_EXTRA + "openssl", openssl_test, +#endif +#ifdef HAVE_ECC + "ecc", ecc_test, +#endif + +#endif /* NO_CRYPT_TEST */ + + "", NULL +} ; + +enum jobtype { FORGROUND, BACKGROUND } ; + +#define IF_DELIMITER(ch) ((ch) == ' ' || (ch) == '\n') + +static int BackGround = 0 ; /* 1: background job is running */ + +char * wolfssl_fgets ( char * str, int num, FILE * f ) +{ + int i ; + + for(i = 0 ; i< num ; i++) { + while((str[i] = getchar()) == 0) { + #if defined (HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + os_tsk_pass (); + #else + osThreadYield (); + #endif + } + if(str[i] == '\n' || str[i] == '\012' || str[i] == '\015') { + putchar('\n') ; + str[i++] = '\n' ; + str[i] = '\0' ; + break ; + } else if(str[i] == '\010') { /* BS */ + if(i) { /* erace one char */ + putchar('\010') ; putchar(' ') ; putchar('\010') ; + i = (i>0 ? (i-2) : -1 ) ; + continue ; + } + } else if(str[i] == '\033' || str[i] == '\004' ) { /* ESC or ^D */ + str[i] = '\0' ; + return(0) ; + } + putchar(str[i]) ; + } + return(str) ; +} + +/******* Get Command Line *****************************/ +static int getline(char * line, int sz, func_args *args, int*bf_flg) +{ + char * ret ; + int i ; + + #define MAXARGS 10 + #define MAXARGLEN 30 + static char *argv[MAXARGS] ; + args->argv = argv ; + + putchar('>') ; + fflush(stdout) ; + ret = wolfssl_fgets(line, sz, stdin) ; + + #define SHELL_ERROR_FGETS -102 + if(ret != line) return(SHELL_ERROR_FGETS) ; + + if(line[strlen(line)-2] == '&') { + (*bf_flg) = BACKGROUND ; + line[strlen(line)-2] = '\n' ; + } else { + (*bf_flg) = FORGROUND ; + } + args->argc = 0 ; + for(i=0; iargv[args->argc] = &(line[i]) ; + while(!IF_DELIMITER(line[i])) i++ ; + args->argc++ ; + if(line[i] == '\n') { + line[i] = '\0' ; + break ; + } else { + line[i] = '\0' ; + } + } + return i ; +} + + +/************* Embedded Shell Commands **********************************/ +#define IP_SIZE 16 + +#ifdef WOLFSSL_KEIL_TCP_NET +static void ipaddr_comm(void *args) +{ + if(((func_args *)args)->argc == 1) { + printf("IP addr: %s, port %d\n", wolfSSLIP, wolfSSLPort) ; + } else { + if(BackGround != 0) { + printf("Cannot change IP addr while background server is running\n") ; + } else if(((func_args *)args)->argc == 3 && + ((func_args *)args)->argv[1][0] == '-'&& + ((func_args *)args)->argv[1][1] == 'a' ) { +/* strcpy(yasslIP, ((func_args *)args)->argv[2]) ; */ + } else if(((func_args *)args)->argc == 3 && + ((func_args *)args)->argv[1][0] == '-' && + ((func_args *)args)->argv[1][1] == 'p' ) { +/* yasslPort = atoi(((func_args *)args)->argv[2]) ; */ + } else printf("Invalid argument\n") ; + } +} + +#endif + + + +#if defined(HAVE_KEIL_RTX) +static int stack_ck = 0 ; + +void stack_comm(void *args) +{ + if(stack_ck) { + printf("Stack Check: Off\n") ; + stack_ck = 0 ; + } else { + printf("Stack Check: On\n") ; + stack_ck = 1 ; + } +} + +#define FILL_PATTERN 0xa596695a +void stack_fill(char * stack, int size) +{ + int i ; + + if(stack_ck == 0)return ; + for(i=1; iargc == 1) { + printf("For %d times\n", for_iteration) ; + } else if( args == NULL || ((func_args *)args)->argc == 2) { + for_iteration = atoi(((func_args *)args)->argv[1]) ; + } else printf("Invalid argument\n") ; +} + + +#if defined(DEBUG_WOLFSSL) + +static int wolfsslDebug = 1 ; + +static void dbg_comm(void *args) +{ + if(wolfsslDebug == 1) { + wolfsslDebug = 0 ; + printf("Turning OFF Debug message\n") ; + wolfSSL_Debugging_OFF() ; + } else { + wolfasslDebug = 1 ; + printf("Turning ON Debug message\n") ; + wolfSSL_Debugging_ON() ; + } +} +#endif + +static void help_comm(void *args) +{ + static char *commands[] = { + "test", + "benchmark", + "echoserver& : simple echo server in background mode", + "echoclient : simple echo client followed by any input string, or \"quit\", \"break\"", + "server& : simple server in background mode", + "client : simple client", + "client -g -v [0123] -h xxx.xxx.xxx.xxx -p 443 : usage example", + "server/client -h : help for server/client command", + "help", + "" + } ; + + int i ; + printf("Commands:\n") ; + for(i=0; commands[i][0] ; i++) + printf(" %s\n", commands[i]) ; + +} + + + +#define BG_JOB_STACK_SIZE 16000 +#if (!defined(NO_SIMPLE_SERVER) && !defined(NO_ECHOSERVER)) && \ + defined(HAVE_KEIL_RTX) +#if !defined(WOLFSSL_CMSIS_RTOS) +static char bg_job_stack[BG_JOB_STACK_SIZE] ; +#endif + +#endif + +#define COMMAND_STACK_SIZE 24000 +#if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) +static char command_stack[COMMAND_STACK_SIZE] ; +#endif + + +#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS) +static wolfSSL_Mutex command_mutex ; +#endif + +void exit_command(void) { + printf("Command Aborted\n") ; + #ifdef WOLFSSL_CMSIS_RTOS + osThreadTerminate(osThreadGetId()) ; + #else + os_tsk_delete_self() ; + #endif +} + + +/*********** Invoke Forground Command *********************/ +static void command_invoke(void const *args) +{ + void (*func)(void const * ) ; + int i,iteration ; + + func = (void(*)(void const *))((func_args *)args)->argv[0] ; + #if defined(HAVE_KEIL_RTX) + LockMutex((wolfSSL_Mutex *)&command_mutex) ; + #endif + iteration = for_iteration ; + for(i=0; i< iteration; i++) { + if(iteration > 1) printf("--- Start for %d ---->\n", i) ; + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + stack_fill(command_stack, COMMAND_STACK_SIZE) ; + #endif + + func(args) ; /* invoke command */ + + #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS) + stack_check(command_stack, COMMAND_STACK_SIZE) ; + #endif + } + + if(iteration > 1) + for_iteration = 1 ; + osDelay(20000) ; + #ifdef HAVE_KEIL_RTX + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; + #ifdef WOLFSSL_CMSIS_RTOS + osThreadTerminate(osThreadGetId()) ; + #else + os_tsk_delete_self() ; + #endif + #endif +} + +#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS) +/******* Invoke Background Job *******************************/ +static void bg_job_invoke(void const *args) +{ + void (*func)(void const * ) ; + BackGround = 1 ; + #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS) + stack_fill(bg_job_stack, BG_JOB_STACK_SIZE) ; + #endif + + func = (void(*)(void const *))((func_args *)args)->argv[0] ; + func(args) ; /* invoke command */ + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + stack_check(bg_job_stack, BG_JOB_STACK_SIZE) ; + #endif + + osDelay(20000) ; + BackGround = 0 ; + + #ifdef WOLFSSL_CMSIS_RTOS + osThreadTerminate(osThreadGetId()) ; + #else + os_tsk_delete_self() ; ; + #endif +} +#endif + +#define LINESIZE 100 +static char line[LINESIZE] ; + +#if defined(WOLFSSL_CMSIS_RTOS) + osThreadDef (command_invoke, osPriorityAboveNormal , 1, COMMAND_STACK_SIZE) ; + osThreadDef (bg_job_invoke, osPriorityNormal , 1 , BG_JOB_STACK_SIZE) ; +#endif +/********* SHEULL MAIN LOOP ***********************************/ +void shell_main(void *arg) { + int i ; + func_args args ; + int bf_flg ; + osThreadId cmd ; + i = BackGround ; + /* Dummy for avoiding warning: BackGround is defined but not used. */ + + #if defined(HAVE_KEIL_RTX) + InitMutex(&command_mutex) ; +#endif + help_comm(NULL) ; + + printf("Starting Shell\n") ; + while(1) { + if(getline(line, LINESIZE, &args, &bf_flg) > 0) { + for(i=0; commandTable[i].func != NULL; i++) { + if(strcmp(commandTable[i].command, args.argv[0]) == 0) { + args.argv[0] = (char *) commandTable[i].func ; + if(bf_flg == FORGROUND) { + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; + os_tsk_create_user_ex( (void(*)(void *))&command_invoke, 7, + command_stack, COMMAND_STACK_SIZE, &args) ; + os_tsk_pass (); + #else + #if defined(WOLFSSL_CMSIS_RTOS) + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; + cmd = osThreadCreate (osThread (command_invoke) , &args); + if(cmd == NULL) { + printf("Cannon create command thread\n") ; + } + osThreadYield (); + #else + command_invoke(&args) ; + #endif + #endif + #ifdef HAVE_KEIL_RTX + LockMutex((wolfSSL_Mutex *)&command_mutex) ; + #endif + } else { + #if (!defined(NO_SIMPLE_SERVER) && \ + !defined(NO_ECHOSERVER)) && \ + defined(HAVE_KEIL_RTX) + if(BackGround != 0) { + printf("Multiple background servers not supported.\n") ; + } else { + printf("\"%s\" is running with the background mode.\n", + commandTable[i].command) ; + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + os_tsk_create_user_ex( (void(*)(void *))&bg_job_invoke, + 6, bg_job_stack, BG_JOB_STACK_SIZE, &args) ; + #else + osThreadCreate (osThread (bg_job_invoke), &args); + osDelay (500) ; + #endif + } + #else + printf("Invalid Command: no background job\n") ; + #endif + } + break ; + } + } + if(commandTable[i].func == NULL) + printf("Command not found\n") ; + } + } +} + diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c new file mode 100644 index 000000000..c825387dd --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c @@ -0,0 +1,43 @@ +/* time-STM32F2.c + * + * Copyright (C) 2006-2015 wolfSSL Inc. + * + * This file is part of wolfSSL. (formerly known as CyaSSL) + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} + diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx new file mode 100644 index 000000000..91b3e7f9a --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx @@ -0,0 +1,387 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + STM32F207 Flash + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Object\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + + 0 + Schematics (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf + + + 1 + User Manual (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm + + + 2 + MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) + http://www.keil.com/mcbstm32f200/ + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + + + + + + 1 + 8 + port + 0 + + + + + 2 + 8 + 0x8004dc8 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + .\shell.c + shell.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + .\time-CortexM3-4.c + time-CortexM3-4.c + 0 + 0 + + + + + Configuration + 1 + 0 + 0 + 0 + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h + 0 + 0 + + + 2 + 5 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 6 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + + + Dcumentation + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + ::CMSIS + 1 + 0 + 0 + 1 + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 + + + + ::Device + 1 + 0 + 0 + 1 + + + + ::File System + 1 + 0 + 0 + 1 + + + + ::Network + 1 + 0 + 0 + 1 + + + + ::wolfSSL + 1 + 0 + 0 + 1 + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx new file mode 100644 index 000000000..29b8b698e --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx @@ -0,0 +1,950 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + STM32F207 Flash + 0x4 + ARM-ADS + + + STM32F207IGHx + STMicroelectronics + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + 0 + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + + + + + + + + + + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Object\ + wolfssl-Full + 1 + 0 + 0 + 1 + 1 + .\Object\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 1 + + + + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_full WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Source + + + main.c + 1 + .\main.c + + + shell.c + 1 + .\shell.c + + + time-CortexM3-4.c + 1 + .\time-CortexM3-4.c + + + + + Configuration + + + config-Crypt.h + 5 + .\RTE\wolfSSL\config-Crypt.h + + + config-wolfSSL.h + 5 + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + Dcumentation + + + Abstract.txt + 5 + .\Abstract.txt + + + + + ::CMSIS + + + ::CMSIS Driver + + + ::Compiler + + + ::Device + + + ::File System + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + + + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + + RTE\File_System\FS_Config.c + + + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\Network\Net_Debug.c + + + + + + RTE\Other\config-Crypt.h + + + + + + RTE\Other\config-CyaSSL.h + + + + + + RTE\Other\config-RTX-TCP-FS.h + + + + + + RTE\Other\config.h + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-CyaSSL.h + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\config.h + + + + + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +