mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Merge pull request #8285 from LinuxJedi/gaisler
Add initial support for Gaisler-BCC with Sparc
This commit is contained in:
@ -638,6 +638,7 @@ WOLFSSL_FRDM_K64
|
|||||||
WOLFSSL_FRDM_K64_JENKINS
|
WOLFSSL_FRDM_K64_JENKINS
|
||||||
WOLFSSL_FUNC_TIME
|
WOLFSSL_FUNC_TIME
|
||||||
WOLFSSL_FUNC_TIME_LOG
|
WOLFSSL_FUNC_TIME_LOG
|
||||||
|
WOLFSSL_GAISLER_BCC
|
||||||
WOLFSSL_GEN_CERT
|
WOLFSSL_GEN_CERT
|
||||||
WOLFSSL_GETRANDOM
|
WOLFSSL_GETRANDOM
|
||||||
WOLFSSL_GNRC
|
WOLFSSL_GNRC
|
||||||
@ -965,6 +966,7 @@ __ppc__
|
|||||||
__riscv
|
__riscv
|
||||||
__riscv_xlen
|
__riscv_xlen
|
||||||
__s390x__
|
__s390x__
|
||||||
|
__sparc
|
||||||
__sparc64__
|
__sparc64__
|
||||||
__sun
|
__sun
|
||||||
__svr4__
|
__svr4__
|
||||||
|
65
IDE/Gaisler-BCC/README.md
Normal file
65
IDE/Gaisler-BCC/README.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# Gaisler BCC
|
||||||
|
|
||||||
|
This document outlines how to compile for the Gaisler LEON range of Sparc CPUs
|
||||||
|
using the BCC2 toolkit. The steps here should also work for the original BCC.
|
||||||
|
|
||||||
|
## Compiler
|
||||||
|
|
||||||
|
In the examples in this document, a Linux computer is used as a cross compiler
|
||||||
|
and the compilers have been extracted to `/opt`. You can install them elsewhere,
|
||||||
|
but please adjust commands accordingly.
|
||||||
|
|
||||||
|
### Bare-metal
|
||||||
|
|
||||||
|
To compile for bare-metal, you need to download the BCC2 binaries from
|
||||||
|
[here](https://www.gaisler.com/index.php/downloads/compilers). You can use
|
||||||
|
either the GCC or CLang version, but do note that you will need to set the
|
||||||
|
CFLAG `-std=c99` to compile in CLang.
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
For Linux, you will need the "GNU toolchains for LEON and NOEL" from
|
||||||
|
[this link](https://www.gaisler.com/index.php/downloads/linux).
|
||||||
|
|
||||||
|
## Compiling
|
||||||
|
|
||||||
|
### Bare metal
|
||||||
|
|
||||||
|
Copy the file `examples/config/user_settings_template.h` to `user_settings.h` in
|
||||||
|
the root of the source code. Then edit this to add the following:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define WOLFSSL_GAISLER_BCC
|
||||||
|
#define WOLFSSL_GENSEED_FORTEST
|
||||||
|
```
|
||||||
|
|
||||||
|
The first `#define` is only required to compile the wolfCrypt benchmark.
|
||||||
|
|
||||||
|
**Note:** that most Gaisler LEON processors do not have a good source of
|
||||||
|
entropy for the RNG. It is recommended an external entropy source is used when
|
||||||
|
developing for production.
|
||||||
|
|
||||||
|
You can then compile with the following. Change `leon5` to the LEON CPU version
|
||||||
|
used:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export CC=/opt/sparc-bcc-2.3.1-gcc/bin/sparc-gaisler-elf-gcc
|
||||||
|
export CXX=/opt/sparc-bcc-2.3.1-gcc/bin/sparc-gaisler-elf-g++
|
||||||
|
export CFLAGS="-mcpu=leon5"
|
||||||
|
|
||||||
|
./configure --host=sparc --enable-usersettings --disable-examples --enable-static
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
To compile for Linux on the LEON use the following commands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export CC=/opt/sparc-gaisler-linux5.10/bin/sparc-gaisler-linux5.10-gcc
|
||||||
|
export CXX=/opt/sparc-gaisler-linux5.10/bin/sparc-gaisler-linux5.10-g++
|
||||||
|
export CFLAGS="-mcpu=leon5"
|
||||||
|
|
||||||
|
./configure --host=sparc-linux
|
||||||
|
make
|
||||||
|
```
|
4
IDE/Gaisler-BCC/include.am
Normal file
4
IDE/Gaisler-BCC/include.am
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# vim:ft=automake
|
||||||
|
# All paths should be given relative to the root
|
||||||
|
|
||||||
|
EXTRA_DIST+= IDE/Gaisler-BCC/README.md
|
@ -14,6 +14,7 @@ include IDE/ECLIPSE/RTTHREAD/include.am
|
|||||||
include IDE/ECLIPSE/SIFIVE/include.am
|
include IDE/ECLIPSE/SIFIVE/include.am
|
||||||
include IDE/Espressif/include.am
|
include IDE/Espressif/include.am
|
||||||
include IDE/GCC-ARM/include.am
|
include IDE/GCC-ARM/include.am
|
||||||
|
include IDE/Gaisler-BCC/include.am
|
||||||
include IDE/HEXAGON/include.am
|
include IDE/HEXAGON/include.am
|
||||||
include IDE/IAR-MSP430/include.am
|
include IDE/IAR-MSP430/include.am
|
||||||
include IDE/Infineon/include.am
|
include IDE/Infineon/include.am
|
||||||
|
@ -14701,6 +14701,16 @@ void bench_sphincsKeySign(byte level, byte optim)
|
|||||||
return (double)ns / 1000000000.0;
|
return (double)ns / 1000000000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(WOLFSSL_GAISLER_BCC)
|
||||||
|
|
||||||
|
#include <bcc/bcc.h>
|
||||||
|
double current_time(int reset)
|
||||||
|
{
|
||||||
|
(void)reset;
|
||||||
|
uint32_t us = bcc_timer_get_us();
|
||||||
|
return (double)us / 1000000.0;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -2785,6 +2785,10 @@ extern void uITRON4_free(void *p) ;
|
|||||||
#undef WOLFSSL_SP_INT_DIGIT_ALIGN
|
#undef WOLFSSL_SP_INT_DIGIT_ALIGN
|
||||||
#define WOLFSSL_SP_INT_DIGIT_ALIGN
|
#define WOLFSSL_SP_INT_DIGIT_ALIGN
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__sparc)
|
||||||
|
#undef WOLFSSL_SP_INT_DIGIT_ALIGN
|
||||||
|
#define WOLFSSL_SP_INT_DIGIT_ALIGN
|
||||||
|
#endif
|
||||||
#if defined(__APPLE__) || defined(WOLF_C89)
|
#if defined(__APPLE__) || defined(WOLF_C89)
|
||||||
#define WOLFSSL_SP_NO_DYN_STACK
|
#define WOLFSSL_SP_NO_DYN_STACK
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user