diff --git a/.gitignore b/.gitignore
index c066b2ca9..c93a89b30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,6 +82,7 @@ cyassl.tgz
*.log
*.trs
IDE\MDK-ARM\Projects/
-IDE\MDK-ARM\STM32F2xx/
+IDE\MDK-ARM\STM32F2xx_StdPeriph_Lib/inc
+IDE\MDK-ARM\STM32F2xx_StdPeriph_Lib/src
IDE\MDK-ARM\LPC43xx\Drivers/
IDE\MDK-ARM\LPC43xx\LPC43xx/
diff --git a/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvopt b/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvopt
index 14992a665..2b66588fc 100644
--- a/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvopt
+++ b/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvopt
@@ -138,7 +138,7 @@
0
ULP2CM3
- -UP1135060 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
+ -UP1135060 -O974 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO23 -TC10000000 -TP18 -TDX0 -TDD0 -TDS7 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
@@ -301,7 +301,7 @@
0
ULP2CM3
- -UP1135060 -O974 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
+ -UP1135060 -O974 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO23 -TC10000000 -TP18 -TDX0 -TDD0 -TDS7 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
@@ -320,7 +320,7 @@
0
1
0
- 0
+ 1
0
0
1
@@ -464,7 +464,7 @@
0
ULP2CM3
- -UP1135060 -O1007 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO22 -TC10000000 -TP18 -TDX0 -TDD0 -TDS0 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
+ -UP1135060 -O975 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO23 -TC10000000 -TP18 -TDX0 -TDD0 -TDS7 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD10000000 -FC800 -FN2 -FF0LPC18xx43xx_512_BA -FS01A000000 -FL080000 -FF1LPC18xx43xx_512_BB -FS11B000000 -FL180000
@@ -619,8 +619,8 @@
0
0
0
- 0
- 0
+ 1
+ 1
0
..\MDK-ARM\CyaSSL\shell.c
shell.c
@@ -633,10 +633,10 @@
1
0
0
- 27
+ 0
0
- 143
- 160
+ 139
+ 156
0
..\MDK-ARM\CyaSSL\main.c
main.c
@@ -675,8 +675,8 @@
0
0
0
- 0
- 0
+ 247
+ 248
0
..\LPC43xx\Drivers\source\lpc43xx_rtc.c
lpc43xx_rtc.c
@@ -811,8 +811,8 @@
0
0
0
- 64
- 84
+ 47
+ 58
0
C:\Keil\ARM\Boards\Keil\MCB4300\RL\FlashFS\SD_File\Serial.c
Serial.c
@@ -843,8 +843,8 @@
0
0
0
- 257
- 272
+ 258
+ 260
0
C:\Keil\ARM\Boards\Keil\MCB4300\RL\FlashFS\SD_File\SDIO_LPC43xx.c
SDIO_LPC43xx.c
@@ -1023,7 +1023,7 @@
Crypt/Cipher Library
- 0
+ 1
0
0
0
@@ -1403,8 +1403,8 @@
0
0
0
- 0
- 0
+ 1
+ 1
0
..\..\..\ctaocrypt\src\random.c
random.c
@@ -1523,8 +1523,8 @@
0
1
0
- 1
- 11
+ 0
+ 0
0
..\MDK-ARM\config\File_Config.c
File_Config.c
@@ -1571,8 +1571,8 @@
0
0
0
- 1
- 1
+ 0
+ 0
0
..\MDK-ARM\config\RTX_Conf_CM.c
RTX_Conf_CM.c
@@ -1603,8 +1603,8 @@
0
0
0
- 0
- 0
+ 1
+ 1
0
..\MDK-ARM\CyaSSL\config-FS.h
config-FS.h
@@ -1619,8 +1619,8 @@
0
0
0
- 0
- 0
+ 1
+ 1
0
..\MDK-ARM\CyaSSL\config-RTX-TCP-FS.h
config-RTX-TCP-FS.h
@@ -1635,8 +1635,8 @@
0
0
0
- 0
- 0
+ 1
+ 1
0
..\MDK-ARM\CyaSSL\config-BARE-METAL.h
config-BARE-METAL.h
@@ -1651,7 +1651,7 @@
0
0
0
- 143
+ 145
151
0
..\LPC43xx\startup_LPC43xx.s
@@ -1675,7 +1675,7 @@
0
0
0
- 170
+ 163
182
0
..\MDK-ARM\CyaSSL\cyassl_MDK_ARM.c
@@ -1691,7 +1691,7 @@
0
0
0
- 56
+ 50
59
0
..\MDK-ARM\CyaSSL\Retarget.c
diff --git a/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvproj b/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvproj
index e25ffe7de..498f50a4c 100644
--- a/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvproj
+++ b/IDE/MDK-ARM/Projects/MDK-ARM-LCP43xx.uvproj
@@ -43,8 +43,8 @@
0
1
- .\Obj\
- SD_File
+ .\MDK-RTX-TCP-FS\
+ LCP43xx-MDK-RTX-TCP-FS
1
0
0
@@ -75,7 +75,7 @@
1
0
- $K\ARM\BIN\ElfDwT.exe !L BASEADDRESS(0x1A000000)
+ $K\ARM\BIN\ElfDwT.exe !L BASEADDRESS(0x1A00000)
0
0
@@ -349,7 +349,7 @@
0
- HAVE_CONFIG_H CYASSL_LPC43xx CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_RTX_TCP_FS
+ HAVE_CONFIG_H CYASSL_LPC43xx __DBG_ITM CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_RTX_TCP_FS
..\MDK-ARM\CyaSSL;../../..;..\LPC43xx\Drivers\include;..\LPC43xx\LPC43xx\Include
@@ -921,8 +921,8 @@
0
1
- .\Obj\
- SD_File
+ .\MDK-FS\
+ LCP43xx-MDK-FS
1
0
0
@@ -1227,7 +1227,7 @@
0
- HAVE_CONFIG_H CYASSL_LPC43xx CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_FS
+ HAVE_CONFIG_H CYASSL_LPC43xx __DBG_ITM CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_FS
..\MDK-ARM\CyaSSL;../../..;..\LPC43xx\Drivers\include;..\LPC43xx\LPC43xx\Include
@@ -2155,8 +2155,8 @@
0
1
- .\Obj\
- SD_File
+ .\MDK-BARE-METAL\
+ LCP43xx-MDK-BARE-METAL
1
0
0
@@ -2461,7 +2461,7 @@
0
- HAVE_CONFIG_H CYASSL_LPC43xx CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_BARE_METAL
+ HAVE_CONFIG_H CYASSL_LPC43xx __DBG_ITM CORE_M4 __RTX USE_STDPERIPH_DRIVER MDK_CONF_BARE_METAL
..\MDK-ARM\CyaSSL;../../..;..\LPC43xx\Drivers\include;..\LPC43xx\LPC43xx\Include
diff --git a/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c
new file mode 100644
index 000000000..66940453a
--- /dev/null
+++ b/IDE/MDK-ARM/STM32F2xx_StdPeriph_Lib/time-STM32F2xx.c
@@ -0,0 +1,185 @@
+/* main.c
+ *
+ * Copyright (C) 2006-2013 wolfSSL Inc.
+ *
+ * This file is part of CyaSSL.
+ *
+ * CyaSSL 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.
+ *
+ * CyaSSL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include
+#endif
+
+#include "time.h"
+#include "stm32f2xx_tim.h"
+#include "stm32f2xx_rcc.h"
+
+
+/*-----------------------------------------------------------------------------
+ * initialize RTC
+ *----------------------------------------------------------------------------*/
+#include "stm32f2xx_rtc.h"
+#include "stm32f2xx_rcc.h"
+#include "stm32f2xx_pwr.h"
+
+static init_RTC()
+{
+ RTC_InitTypeDef RTC_InitStruct ;
+
+ RTC_TimeTypeDef RTC_Time ;
+ RTC_DateTypeDef RTC_Date ;
+
+
+ /* Enable the PWR clock */
+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
+
+ /* Allow access to RTC */
+ PWR_BackupAccessCmd(ENABLE);
+
+/***Configures the External Low Speed oscillator (LSE)****/
+
+ RCC_LSEConfig(RCC_LSE_ON);
+
+ /* Wait till LSE is ready */
+ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)
+ {
+ }
+
+ /* Select the RTC Clock Source */
+ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
+
+ /* Enable the RTC Clock */
+ RCC_RTCCLKCmd(ENABLE);
+
+ /* Wait for RTC APB registers synchronisation */
+ RTC_WaitForSynchro();
+
+ /* Calendar Configuration with LSI supposed at 32KHz */
+ RTC_InitStruct.RTC_AsynchPrediv = 0x7F;
+ RTC_InitStruct.RTC_SynchPrediv = 0xFF;
+ RTC_InitStruct.RTC_HourFormat = RTC_HourFormat_24;
+ RTC_Init(&RTC_InitStruct);
+
+ RTC_GetTime(RTC_Format_BIN, &RTC_Time) ;
+ RTC_GetDate(RTC_Format_BIN, &RTC_Date) ;
+}
+
+/*-----------------------------------------------------------------------------
+ * initialize TIM
+ *----------------------------------------------------------------------------*/
+static void init_TIM()
+{
+ TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure ;
+
+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE) ;
+
+ TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
+ TIM_TimeBaseStructure.TIM_Prescaler = 60;
+ TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
+ TIM_TimeBaseStructure.TIM_Period = 0xffffffff;
+ TIM_TimeBaseStructure.TIM_ClockDivision = 0;
+ TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
+
+ TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
+
+ TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure) ;
+ TIM_Cmd(TIM2, ENABLE) ;
+}
+
+void init_time(void) {
+ init_RTC() ;
+ init_TIM() ;
+}
+
+struct tm *Cyassl_MDK_gmtime(const time_t *c)
+{
+
+ RTC_TimeTypeDef RTC_Time ;
+ RTC_DateTypeDef RTC_Date ;
+ static struct tm date ;
+
+ RTC_GetTime(RTC_Format_BIN, &RTC_Time) ;
+ RTC_GetDate(RTC_Format_BIN, &RTC_Date) ;
+
+ date.tm_year = RTC_Date.RTC_Year + 100 ;
+ date.tm_mon = RTC_Date.RTC_Month - 1 ;
+ date.tm_mday = RTC_Date.RTC_Date ;
+ date.tm_hour = RTC_Time.RTC_Hours ;
+ date.tm_min = RTC_Time.RTC_Minutes ;
+ date.tm_sec = RTC_Time.RTC_Seconds ;
+
+ #if defined(DEBUG_CYASSL)
+ {
+ char msg[100] ;
+ sprintf(msg, "Debug::Cyassl_KEIL_gmtime(DATE=/%4d/%02d/%02d TIME=%02d:%02d:%02d)\n",
+ RTC_Date.RTC_Year+2000, RTC_Date.RTC_Month, RTC_Date.RTC_Date,
+ RTC_Time.RTC_Hours, RTC_Time.RTC_Minutes, RTC_Time.RTC_Seconds) ;
+ CYASSL_MSG(msg) ;
+ }
+ #endif
+
+ return(&date) ;
+}
+
+double current_time()
+{
+ return ((double)TIM2->CNT/1000000.0) ;
+}
+
+typedef struct func_args {
+ int argc;
+ char** argv;
+ int return_code;
+} func_args;
+
+
+#include
+
+void time_main(void *args)
+{
+ char * datetime ;
+ RTC_TimeTypeDef RTC_Time ;
+ RTC_DateTypeDef RTC_Date ;
+ int year ;
+ if( args == NULL || ((func_args *)args)->argc == 1) {
+ RTC_GetTime(RTC_Format_BIN, &RTC_Time) ;
+ RTC_GetDate(RTC_Format_BIN, &RTC_Date) ;
+ printf("Date: %d/%d/%d, Time: %02d:%02d:%02d\n",
+ RTC_Date.RTC_Month, RTC_Date.RTC_Date, RTC_Date.RTC_Year+2000,
+ RTC_Time.RTC_Hours, RTC_Time.RTC_Minutes, RTC_Time.RTC_Seconds) ;
+ } else if(((func_args *)args)->argc == 3 &&
+ ((func_args *)args)->argv[1][0] == '-' &&
+ ((func_args *)args)->argv[1][1] == 'd' ) {
+ datetime = ((func_args *)args)->argv[2];
+ sscanf(datetime, "%d/%d/%d",
+ (int *)&RTC_Date.RTC_Month, (int *)&RTC_Date.RTC_Date, &year) ;
+ RTC_Date.RTC_Year = year - 2000 ;
+ RTC_Date.RTC_WeekDay = 0 ;
+ RTC_SetDate(RTC_Format_BIN, &RTC_Date) ;
+ } else if(((func_args *)args)->argc == 3 &&
+ ((func_args *)args)->argv[1][0] == '-' &&
+ ((func_args *)args)->argv[1][1] == 't' ) {
+ datetime = ((func_args *)args)->argv[2];
+ sscanf(datetime, "%d:%d:%d",
+ (int *)&RTC_Time.RTC_Hours,
+ (int *)&RTC_Time.RTC_Minutes,
+ (int *)&RTC_Time.RTC_Seconds
+ ) ;
+ RTC_SetTime(RTC_Format_BIN, &RTC_Time) ;
+ } else printf("Invalid argument\n") ;
+}
+
+
diff --git a/ctaocrypt/src/random.c b/ctaocrypt/src/random.c
index 3518ab98c..05daae965 100644
--- a/ctaocrypt/src/random.c
+++ b/ctaocrypt/src/random.c
@@ -567,16 +567,16 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return 0;
}
-#elif defined(CYASSL_LPC43xx)
- #warning "write a real random seed!!!!, just for testing now"
- int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
- {
- int i;
- for (i = 0; i < sz; i++ )
- output[i] = i;
- return 0;
- }
-
+#elif defined(CYASSL_LPC43xx)
+ #warning "write a real random seed!!!!, just for testing now"
+ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
+ {
+ int i;
+ for (i = 0; i < sz; i++ )
+ output[i] = i;
+ return 0;
+ }
+
#elif defined(NO_DEV_RANDOM)
#error "you need to write an os specific GenerateSeed() here"