Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lfs with MBEDTLS_PSA_ITS_FILE_C doesn't compile #279

Open
Vernon-Naidoo-1 opened this issue Jul 4, 2023 · 5 comments
Open

lfs with MBEDTLS_PSA_ITS_FILE_C doesn't compile #279

Vernon-Naidoo-1 opened this issue Jul 4, 2023 · 5 comments
Labels

Comments

@Vernon-Naidoo-1
Copy link

Vernon-Naidoo-1 commented Jul 4, 2023

FSP Version: 4.3
Debugger: J-Link (SWD)
Processor: RA6M2
OS: FreeRTOS
IDE: VS Code
Build Type: CMake
Toolchain: arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi

I understand that this isn't the toolchain specified along side the FSP release, but that version of the toolchain breaks other 3rd party parts of our code.

How to replicate:

Add mbedtls (crypto only), attach lfs file system and the sce7, try running the renesas example code for generating a persistent key and using with AES, with the specified toolchain.

Issue

This code fails to compile when enabling MBEDTLS_PSA_ITS_FILE_C. I have traced this and it seems to work (at least the demo code does) if I redefine remove in this line
#define remove(file) lfs_remove(MBEDTLS_CONFIG_LFS, file)
To something else and update the calls in psa_its_file.c.
It seems that there is a conflict with the file definition arising from the toolchain itself.

Please advise on this issue.

@Vernon-Naidoo-1
Copy link
Author

Update: the rename function suffers from the same problem. Not sure if the others would too if another feature was turned on

@renesas-brandon-hussey
Copy link
Collaborator

Hi @Vernon-Naidoo-1 , we are working on updating FSP to support that GCC version. We tried to replicate the error you are encountering with FSP v4.3.0 and e2 studio and were not able to do so. You're going to need to provide more information for us to figure out the issue. Can you provide us the command line for the build and the output you're seeing?

@Vernon-Naidoo-1
Copy link
Author

Hi @renesas-brandon-hussey. I'm using CMake on VS code in a wsl environment to build

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.6 LTS
Release:        20.04
Codename:       focal

This is the build command line
cmake -H. -Bbuild -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_PATH -DLIBRARY_LOG_LEVEL=0 -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug $BUILD_DEFINES -DUSR_LOG_LVL=$DEBUG_LVL

It should also be noted that I've updated to fsp 4.5 and this problem persists. Also, this is primarily a c++ project with a few c interfaces and the FSP c code. What information would you need?

@Vernon-Naidoo-1
Copy link
Author

Sorry missed the second part of your request. Looking more closely at the errors, you may need to include the nlohmann c++ json library to see the conflicts, as this seems to use the toolchain version of these functions and that seems to be when the conflict arrises. There are a lot of error when these functions are left as is but here are a few pertaining to this. There's 157 errors in total though all are along these lines, since the definition of these functions in the toolchain are different to the ones in the lfs headers. If you need the entire output please let me know as I'll have to sanitise it before sending.

  /opt/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi/arm-none-eabi/include/c++/12.2.1/bits/fs_ops.h:344:8: error: variable or field 'lfs_rename_raw' declared void
  344 |   void rename(const path& __from, const path& __to);
      |        ^~~~~~
/opt/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi/arm-none-eabi/include/c++/12.2.1/bits/fs_ops.h:344:8: error: expected primary-expression before 'const'
  344 |   void rename(const path& __from, const path& __to);
      |        ^~~~~~
/opt/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi/arm-none-eabi/include/c++/12.2.1/bits/fs_ops.h:344:8: error: expected primary-expression before 'const'
  344 |   void rename(const path& __from, const path& __to);
      |        ^~~~~~
/opt/arm-gnu-toolchain-12.2.mpacbti-rel1-x86_64-arm-none-eabi/arm-none-eabi/include/c++/12.2.1/bits/fs_ops.h:345:71: error: expected initializer before 'noexcept'

/home/build/workspace/project/json/include/nlohmann/detail/output/serializer.hpp:846:41: error: missing template arguments before '(' token
  846 |             const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep);
      |                                         ^
In file included from /home/build/workspace/project/json/include/nlohmann/json.hpp:59:
/home/build/workspace/project/json/include/nlohmann/detail/output/serializer.hpp: In member function 'void nlohmann::json_abi_v3_11_2::detail::serializer<BasicJsonType>::dump_float(number_float_t, std::false_type)':
/home/build/workspace/project/json/include/nlohmann/detail/output/serializer.hpp:846:41: error: missing template arguments before '(' token
  846 |             const auto end = std::remove(number_buffer.begin(), number_buffer.begin() + len, thousands_sep);

@renesas-brandon-hussey
Copy link
Collaborator

This is being internally tracked using FSPRA-2354.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants