Topic: wolfCrypt with mwcceppc

Hello,

I am using mwcceppc (Freescale C/C++ Compiler for Embedded PowerPC) in Eclipse IDE for Embedded C/C++ Developers to build a project with wolfCrypt for ST Microelectronics SPC560P Chip. I include the wolfCrypt libraries in the makefile and just add the line  #include <wolfssl/wolfcrypt/aes.h>.

Upon building the project, I get the error:

..\..\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\wc_port.h:828: undefined identifier 'DIR'
..\..\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\wc_port.h:828: (included from:
..\..\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\wc_port.h:828:      C:\Users\asn\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\types.h:35
..\..\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\wc_port.h:828:      C:\Users\asn\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\aes.h:41
..\..\Desktop\Crypt\wolfssl-5.7.2\wolfssl\wolfcrypt\wc_port.h:828:      C:\Users\asn\e_workspace\cryptoProject\application\scheduler\main.c:15)



The only change in the wolfCrypt code I have done is  #define SINGLE_THREADED in the aes.h file.


  • Any suggestion how I can resolve this ?

  • I see that in settings.h file, there is no settings for PowerPC but I believe the wolfCrypt can be used with PowerPC after a little bit of changes. I would be happy if someone can confirm this ?

Share

Re: wolfCrypt with mwcceppc

Hi asn,

Welcome to the wolfSSL Forums.

You should not add configuration defines in the source files. This will always result in undefined behavior.

This is the preferred method for configuring the library:
https://www.wolfssl.com/using-user_settings-h-wolfssl/

Yes, you can build wolfSSL for PPC. The environment variable `__ppc__` will be detected to set up the correct settings for that architecture.

Let us know if there are questions.

Thanks,
Eric - wolfSSL Support

Re: wolfCrypt with mwcceppc

Thank you for your reply.

1. Noted. Will use user_settings.h for defining configurations.

2. How do I build the static library files for PPC? I am using MSYS2 MINGW64. And where do I define the environment variable `__ppc__` to be detected in order to build wolfCrypt for PPC architecture ?

Share

Re: wolfCrypt with mwcceppc

When you set up the cross compilation in the configure step, the tools will have that macro available.
https://www.wolfssl.com/documentation/m … ss-compile

Re: wolfCrypt with mwcceppc

Since I am using a Windows machine, I am unable to install the appropriate PowerPC cross-compiler (powerpc-linux-gnu-gcc) in Cygwin64 or MSYS2. Therefore, I assume that I will need to generate the library files on a Linux machine. I hope this assumption is correct.

Share

Re: wolfCrypt with mwcceppc

I'm not going to say its impossible, but certainly it will be more straightforward on Linux.

Re: wolfCrypt with mwcceppc

Can you try using WSL to install the PPC compiler and build the wolfSSL lib there?

Re: wolfCrypt with mwcceppc

Thank you for the suggestion. These are the steps I followed:

1. Installed WSL in my Windows Machine.
2. Installed `sudo apt-get install gcc-powerpc-linux-gnu`
3. Downloaded wolfSSL from GitHub
4. Extracted and ran `./autogen.sh`
5. Then ran `./configure   --host=powerpc-linux-gnu   CC=powerpc-linux-gnu-gcc   AR=powerpc-linux-gnu-ar   STRIP=powerpc-linux-gnu-strip   RANLIB=powerpc-linux-gnu-ranlib   --prefix=/path/to/install/wolfssl-powerpc   --disable-shared   --enable-static`
6. Then I copied the library and include folder to my Windows Machine.
7. In my make file, I included this folder and library file.

I am adding these steps in case it helps someone in the future. For my case it did not work as the compiler I use is mwcceppc and the configuration I did was with GCC.

I will try to run with the ./configure command with mwcceppc compiler and update here if it works. In case there any other suggestions let me know.

Share

Re: wolfCrypt with mwcceppc

I tried to run the ./configure in MSYS2 MINGW64 with mwcceppc compiler, but it is not creating executables:


$ ./configure \
  --host=powerpc-eabi \
  CC=mwcceppc.exe \
  AR=mwldeppc.exe \
  STRIP=mwldeppc.exe \
  RANLIB=mwldeppc.exe \
  --prefix=/path/to/install/wolfssl-powerpc \
  --disable-shared \
  --enable-static
configure: loading site script /etc/config.site
checking for powerpc-eabi-gcc... mwcceppc.exe
checking whether the C compiler works... no
configure: error: in `/c/Users/asn/Desktop/CryptCW/wolfssl-5.7.2':
configure: error: C compiler cannot create executables
See `config.log' for more details


As I am a beginner, I am not sure if I should be spending more time trying to make it work with mwcceppc (Freescale C/C++ Compiler for Embedded PowerPC). Am I close to make it work or should I stop trying ?

Share

Re: wolfCrypt with mwcceppc

Is the compiler in the environment path? Can you invoke it from the command line right there?