mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Merge pull request #3273 from dgarske/xilinx_vitis
Xilinx SDK / Vitis improvements
This commit is contained in:
0
IDE/XilinxSDK/2018_2/.cproject
Executable file → Normal file
0
IDE/XilinxSDK/2018_2/.cproject
Executable file → Normal file
0
IDE/XilinxSDK/2018_2/.project
Executable file → Normal file
0
IDE/XilinxSDK/2018_2/.project
Executable file → Normal file
0
IDE/XilinxSDK/2018_2/lscript.ld
Executable file → Normal file
0
IDE/XilinxSDK/2018_2/lscript.ld
Executable file → Normal file
@@ -1,6 +1,6 @@
|
||||
# Common Gotcha's
|
||||
|
||||
- If compiling all code togther (ie no sperate wolfssl library) than the -fPIC compiler flag should be used. Without using -fPIC in this build setup there could be unexpected failures.
|
||||
- If compiling all code together (ie no separate wolfssl library) than the -fPIC compiler flag should be used. Without using -fPIC in this build setup there could be unexpected failures.
|
||||
- If building with ARMv8 crypto extensions then the compiler flags "-mstrict-align -mcpu=generic+crypto" must be used.
|
||||
- Check that enough stack and heap memory is set for the operations if a crash or stall happens.
|
||||
|
||||
@@ -20,14 +20,14 @@ To use this example project:
|
||||
- File->New->Platform Project
|
||||
- Setting "Project name" to standalone_bsp_0, then click "Next"
|
||||
- Select the "Create from hardware specification" radius and click "Next"
|
||||
- "Browse..." to the desired XSA file for the hardare
|
||||
- "Browse..." to the desired XSA file for the hardware
|
||||
- (optional) change Processor to R5 now
|
||||
- click "Finish"
|
||||
3. (optional) If building for TLS support than expand the standalone_bsp_0 project, double click on platform_spr, Expand the cpu (i.e psu_cortexa53_0), click on Board Support Package, select the "Modify BSP Settings..." box and click on lwip211. Note that the api_mode should be changed from RAW API to SOCKET API.
|
||||
4. Right click on the standalone_bsp_0 project and click on "Build Project"
|
||||
5. Import the wolfcrypt example project "File->Import->Eclipse workspace or zip file"
|
||||
6. Uncheck "Copy projects into workspace"
|
||||
7. Select the root directory of wolfssl/IDE/XilinxSDK/2019_2, and select wolfCrypt_example and wolfCrypt_example_system. Then click "Finish"
|
||||
7. Select the root directory of `wolfssl/IDE/XilinxSDK/2019_2`, and select `wolfCrypt_example` and `wolfCrypt_example_system`. Then click "Finish"
|
||||
|
||||
|
||||
# Steps For Creating Project From Scratch
|
||||
@@ -37,7 +37,7 @@ To use this example project:
|
||||
- File->New->Platform Project
|
||||
- Setting "Project name" to standalone_bsp_0, then click "Next"
|
||||
- Select the "Create from hardware specification" radius and click "Next"
|
||||
- "Browse..." to the desired XSA file for the hardare
|
||||
- "Browse..." to the desired XSA file for the hardware
|
||||
- (optional) change Processor to R5 now
|
||||
- click "Finish"
|
||||
3. (optional) If building for TLS support than expand the standalone_bsp_0 project, double click on platform_spr, Expand the cpu (i.e psu_cortexa53_0), click on Board Support Package, select the "Modify BSP Settings..." box and click on lwip211. Note that the api_mode should be changed from RAW API to SOCKET API.
|
||||
@@ -49,10 +49,10 @@ To use this example project:
|
||||
9. Expand the wolfCrypt_example project and right click on the folder "src".
|
||||
10. Select "Import Sources" and set the "From directory" to be the wolfssl root directory.
|
||||
11. Select the folders to import as ./src, ./IDE/XilinxSDK, ./wolfcrypt/benchmark, ./wolfcrypt/test, ./wolfcrypt/src
|
||||
12. (optional) Expand the Advanced tabe and select "Create links in workspace"
|
||||
12. (optional) Expand the Advanced table and select "Create links in workspace"
|
||||
13. Click on "Finish"
|
||||
14. Expand the wolfcrypt/src directory and exlude all .S files from the build
|
||||
15. Right click on the wolfCrypt_example project and got to Properties. Set the macro WOLFSSL_USER_SETTINGS in C/C++ Build->Settings->ARM v8 gcc compiler->Symbols
|
||||
14. Expand the wolfcrypt/src directory and exclude all .S files from the build
|
||||
15. Right click on the wolfCrypt_example project and got to Properties. Set the macro `WOLFSSL_USER_SETTINGS` in C/C++ Build->Settings->ARM v8 gcc compiler->Symbols
|
||||
16. Set the include path for finding user_settings.h by going to the Properties and setting it in C/C++ Build->Settings->ARM v8 gcc compiler->Directories. This is to the directory wolfssl/IDE/XilinxSDK
|
||||
17. Set the include path for finding wolfSSL headers. To the root directory wolfssl
|
||||
18. Add compiler flags "-fPIC -mstrict-align -mcpu=generic+crypto" to the project properties. C/C++ Build->Settings->ARM v8 gcc compiler->Miscellaneous
|
||||
|
0
IDE/XilinxSDK/user_settings.h
Executable file → Normal file
0
IDE/XilinxSDK/user_settings.h
Executable file → Normal file
@@ -230,6 +230,8 @@ void WOLFSSL_TIME(int count)
|
||||
#include "m2m_log.h"
|
||||
#elif defined(WOLFSSL_ANDROID_DEBUG)
|
||||
#include <android/log.h>
|
||||
#elif defined(WOLFSSL_XILINX)
|
||||
#include "xil_printf.h"
|
||||
#else
|
||||
#include <stdio.h> /* for default printf stuff */
|
||||
#endif
|
||||
@@ -274,6 +276,8 @@ static void wolfssl_log(const int logLevel, const char *const logMessage)
|
||||
M2M_LOG_INFO("%s\n", logMessage);
|
||||
#elif defined(WOLFSSL_ANDROID_DEBUG)
|
||||
__android_log_print(ANDROID_LOG_VERBOSE, "[wolfSSL]", "%s", logMessage);
|
||||
#elif defined(WOLFSSL_XILINX)
|
||||
xil_printf("%s\r\n", logMessage);
|
||||
#else
|
||||
fprintf(stderr, "%s\n", logMessage);
|
||||
#endif
|
||||
|
@@ -2150,7 +2150,7 @@ time_t XTIME(time_t * timer)
|
||||
#if defined(WOLFSSL_XILINX)
|
||||
#include "xrtcpsu.h"
|
||||
|
||||
time_t XTIME(time_t * timer)
|
||||
time_t xilinx_time(time_t * timer)
|
||||
{
|
||||
time_t sec = 0;
|
||||
XRtcPsu_Config* con;
|
||||
|
@@ -2167,7 +2167,7 @@ WOLFSSL_API WOLFSSL_X509*
|
||||
WOLFSSL_API int wolfSSL_i2d_X509(WOLFSSL_X509* x509, unsigned char** out);
|
||||
WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL(WOLFSSL_X509_CRL **crl,
|
||||
const unsigned char *in, int len);
|
||||
#ifndef NO_FILESYSTEM
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
|
||||
WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL_fp(XFILE file, WOLFSSL_X509_CRL **crl);
|
||||
#endif
|
||||
WOLFSSL_API void wolfSSL_X509_CRL_free(WOLFSSL_X509_CRL *crl);
|
||||
@@ -2202,7 +2202,7 @@ typedef struct WC_PKCS12 WC_PKCS12;
|
||||
WOLFSSL_API WC_PKCS12* wolfSSL_d2i_PKCS12_bio(WOLFSSL_BIO* bio,
|
||||
WC_PKCS12** pkcs12);
|
||||
WOLFSSL_API int wolfSSL_i2d_PKCS12_bio(WOLFSSL_BIO *bio, WC_PKCS12 *pkcs12);
|
||||
#ifndef NO_FILESYSTEM
|
||||
#if !defined(NO_FILESYSTEM) && !defined(NO_STDIO_FILESYSTEM)
|
||||
WOLFSSL_API WOLFSSL_X509_PKCS12* wolfSSL_d2i_PKCS12_fp(XFILE fp,
|
||||
WOLFSSL_X509_PKCS12** pkcs12);
|
||||
#endif
|
||||
|
@@ -418,6 +418,23 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#define XBADFILE -1
|
||||
#define XFGETS(b,s,f) -2 /* Not ported yet */
|
||||
|
||||
#elif defined (WOLFSSL_XILINX)
|
||||
#include "xsdps.h"
|
||||
#include "ff.h"
|
||||
|
||||
/* workaround to declare variable and provide type */
|
||||
#define XFILE FIL curFile; FIL*
|
||||
#define XFOPEN(NAME, MODE) ({ FRESULT res; res = f_open(&curFile, (NAME), (FA_OPEN_ALWAYS | FA_WRITE | FA_READ)); (res == FR_OK) ? &curFile : NULL; })
|
||||
#define XFSEEK(F, O, W) f_lseek((F), (O))
|
||||
#define XFTELL(F) f_tell((F))
|
||||
#define XREWIND(F) f_rewind((F))
|
||||
#define XFREAD(BUF, SZ, AMT, F) ({ FRESULT res; UINT br; res = f_read((F), (BUF), (SZ)*(AMT), &br); (void)br; res; })
|
||||
#define XFWRITE(BUF, SZ, AMT, F) ({ FRESULT res; UINT written; res = f_write((F), (BUF), (SZ)*(AMT), &written); (void)written; res; })
|
||||
#define XFCLOSE(F) f_close((F))
|
||||
#define XSEEK_END 0
|
||||
#define XBADFILE NULL
|
||||
#define XFGETS(b,s,f) f_gets((b), (s), (f))
|
||||
|
||||
#elif defined(WOLFSSL_USER_FILESYSTEM)
|
||||
/* To be defined in user_settings.h */
|
||||
#else
|
||||
@@ -535,7 +552,9 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#define NEED_TMP_TIME
|
||||
|
||||
#elif defined(WOLFSSL_XILINX)
|
||||
#define USER_TIME
|
||||
#ifndef XTIME
|
||||
#define XTIME(t1) xilinx_time((t1))
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#elif defined(HAVE_RTP_SYS)
|
||||
@@ -750,7 +769,7 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#endif
|
||||
|
||||
#ifndef FILE_BUFFER_SIZE
|
||||
#define FILE_BUFFER_SIZE 1024 /* default static file buffer size for input,
|
||||
#define FILE_BUFFER_SIZE 1024 /* default static file buffer size for input, \
|
||||
will use dynamic buffer if not big enough */
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user