Multi Source Translation Content

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multi Source Translation Content

Discussions

Sort by:
MCU 技術トピック: ハンズオン・ワークショップ: S32K MCU での CSEc セキュリティ・ソフトウェアの作成 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> CSEcセキュリティ運用のためのデバイスの準備とプログラミングの方法を示すハンズオンセッションです。このセッションでは、CSEcモジュールをプログラムするためのベアメタルとSDKの両方のアプローチについても説明します。NVMの部分では、NXPが耐久性を計算するために提供するさまざまなタイプのメモリとツールの有効化/構成について説明します。 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> CSEcセキュリティ運用のためのデバイスの準備とプログラミングの方法を示すハンズオンセッションです。このセッションでは、CSEcモジュールをプログラムするためのベアメタルとSDKの両方のアプローチについても説明します。NVMの部分では、NXPが耐久性を計算するために提供するさまざまなタイプのメモリとツールの有効化/構成について説明します。
View full article
恩智浦的xEV能源管理解决方案 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 中国预计到2020年,每家汽车制造商将生产和销售12%的零排放电动汽车,大城市将禁止经典内燃机汽车,汽车制造商将以更快的速度推出新型电动汽车。本次会议将概述影响电动汽车市场的主要力量,描述主要的架构方法和系统组件,以及这对恩智浦具有哪些增长潜力。 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 中国预计到2020年,每家汽车制造商将生产和销售12%的零排放电动汽车,大城市将禁止经典内燃机汽车,汽车制造商将以更快的速度推出新型电动汽车。本次会议将概述影响电动汽车市场的主要力量,描述主要的架构方法和系统组件,以及这对恩智浦具有哪些增长潜力。
View full article
应用FXTH8700作为TPMS发射器 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> FXTH87xx 是一款用于监测轮胎压力和温度的传感器。它包含压力和温度传感器、X 轴和 Z 轴加速度计、微控制器、低频接收器和射频发射器。 在一个包内。 最近有客户咨询如何将 FXTH87xx 与英飞凌TPMS 接收器连接。我们经过一系列测试和验证,最终成功连接。本文档旨在介绍如何用 FXTH87xx 替换外部发射器。本文将以示例的方式,向用户介绍如何使用 R&S 或 Anritsu 提供的仪器检测和解码未知传感器的发射器数据包,然后将这些发射器数据包复制到 FXTH87xx 中,从而形成 315MHz、433.92MHz 的 TPMS 接收器。 发射器和接收器解决方案。采用 FXTH87xx 的客户可以使用类似的 概念。 压力传感器
View full article
AUT-N1773 - セキュア V2X イントロ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 米国政府が米国での車間通信の義務化を準備する中、自動車業界は、この専用短距離通信技術をサポートする車を提供する準備を進めています。これが道路利用者にどのようなメリットをもたらすか、ITS-G5規格が世界中でどのように展開されているか、これを市場に投入する際に自動車業界が直面する課題、およびこの展開におけるNXPのリーダーシップの役割について見ていきます。 ビデオプレゼンテーションを見る <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 米国政府が米国での車間通信の義務化を準備する中、自動車業界は、この専用短距離通信技術をサポートする車を提供する準備を進めています。これが道路利用者にどのようなメリットをもたらすか、ITS-G5規格が世界中でどのように展開されているか、これを市場に投入する際に自動車業界が直面する課題、およびこの展開におけるNXPのリーダーシップの役割について見ていきます。 ビデオプレゼンテーションを見る セキュアなコネクテッド&自動運転車
View full article
INS-N2085 Simulity Labs:更大并不一定更好 - 使用 eSIM 节省参考设计中的空间 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 使用 eSIM 节省参考设计中的空间。eSIM(eUICC)及其对芯片组制造商和设备 OEM 的意义。如今,消费者想要更大的屏幕、更长的电池寿命、更大的存储空间、更丰富的媒体内容等等。eSIM 将带来的 (R) 变革是独一无二的、颠覆性的,可以与黑白电视变成彩色电视的时代相媲美。OEM 正在缓慢采用,但就像黑白电视时代一样,网络尚未准备好,就 eSIM 而言,移动运营商也尚未准备好! <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 使用 eSIM 节省参考设计中的空间。eSIM(eUICC)及其对芯片组制造商和设备 OEM 的意义。如今,消费者想要更大的屏幕、更长的电池寿命、更大的存储空间、更丰富的媒体内容等等。eSIM 将带来的 (R) 变革是独一无二的、颠覆性的,可以与黑白电视变成彩色电视的时代相媲美。OEM 正在缓慢采用,但就像黑白电视时代一样,网络尚未准备好,就 eSIM 而言,移动运营商也尚未准备好! 洞察与创新
View full article
TN013_LPCOpen UART RB示例Tx问题 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> lpcopen。uart #ring_buffer
View full article
SMI-N2027 Toradex - 基于 i.MX 7 异构非对称架构、FreeRTOS 和 Qt 的平衡机器人 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 本技术讲座介绍了 Toradex 如何使用全新 i.MX 7 的异构非对称架构构建平衡机器人演示应用程序。i.MX 7 具有辅助 Cortex-M4,可用于实时或低功耗应用。我们将讨论如何利用基于 FreeRTOS 的固件的辅助核心实现闭环控制器来保持机器人平衡直立。在强大的主 CPU 复合体(双 Cortex-A7)上,Linux 正在运行基于 Qt 的用户界面。我们将详细介绍 NXP 提供的基于 rpmsg/OpenAMP 的消息传递产品。机器人演示应用程序利用 rpmsg 在两个独立运行的处理器核心和操作系统之间进行通信。 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 本技术讲座介绍了 Toradex 如何使用全新 i.MX 7 的异构非对称架构构建平衡机器人演示应用程序。i.MX 7 具有辅助 Cortex-M4,可用于实时或低功耗应用。我们将讨论如何利用基于 FreeRTOS 的固件的辅助核心实现闭环控制器来保持机器人平衡直立。在强大的主 CPU 复合体(双 Cortex-A7)上,Linux 正在运行基于 Qt 的用户界面。我们将详细介绍 NXP 提供的基于 rpmsg/OpenAMP 的消息传递产品。机器人演示应用程序利用 rpmsg 在两个独立运行的处理器核心和操作系统之间进行通信。 智能机械和工业自动化
View full article
DwF 深圳 - 2015-06-25 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 汽车和联网汽车 设计、软件和服务 IAR:C 环境下的安全 智能工业 洞察与创新 智能网络
View full article
DwF物联网无线模块解决方案 - 广州 - 2015-06-11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 智能家居和建筑 实践研讨会:物联网 Wi-Fi 模块开发套件 - 快速入门 智能网络
View full article
Technical Report Valasi.pdf The Freescale Cup High School Challenge technical report from team Valasi from Stredni Skola informatiky, Elektrotechniky a Remesel Roznov (Czech Republic) The Freescale Cup High School Challenge technical report from team Valasi from Stredni Skola informatiky, Elektrotechniky a Remesel Roznov (Czech Republic)
View full article
Example MPC5566EVB PinToggleStationery CW210 ******************************************************************************** * Detailed Description: * Application performs basic initialization, setup PLL to maximum allowed freq., * initializes interrupts, blinking one LED by interrupt, second LED by software * loop, initializes and display notice via UART terminal and then terminal ECHO. * The example configures the device for maximum performance (OPTIMIZATIONS_ON). * Its intention is to offer advanced startup code additional to CW stationery. * ------------------------------------------------------------------------------ * Test HW:        MPC5566EVB * MCU:            PPC5566MVR132 * Fsys:           144/132/112/80/12 MHz * Debugger:       Lauterbach Trace32 *                 PeMicro USB-ML-PPCNEXUS * Target:         RAM, internal_FLASH * Terminal:       19200-8-no parity-1 stop bit-no flow control on eSCI_A * EVB connection: TPU_PORT_37 -> USER_LED_8 *                 TPU_PORT_38 -> USER_LED_7 (to see blinking LEDs)    * ******************************************************************************** ******************************************************************************** * Detailed Description: * Application performs basic initialization, setup PLL to maximum allowed freq., * initializes interrupts, blinking one LED by interrupt, second LED by software * loop, initializes and display notice via UART terminal and then terminal ECHO. * The example configures the device for maximum performance (OPTIMIZATIONS_ON). * Its intention is to offer advanced startup code additional to CW stationery. * ------------------------------------------------------------------------------ * Test HW:        MPC5566EVB * MCU:            PPC5566MVR132 * Fsys:           144/132/112/80/12 MHz * Debugger:       Lauterbach Trace32 *                 PeMicro USB-ML-PPCNEXUS * Target:         RAM, internal_FLASH * Terminal:       19200-8-no parity-1 stop bit-no flow control on eSCI_A * EVB connection: TPU_PORT_37 -> USER_LED_8 *                 TPU_PORT_38 -> USER_LED_7 (to see blinking LEDs)    * ******************************************************************************** General
View full article
如何为 KSDK 和 PEx 项目的新 MQX RTOS 添加 MFS 和 Shell 支持 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 大家好, 基于如何使用 KDS 和 KSDK 将 RTCS 添加到处理器专家项目,您可以在下面找到使用 KSDK1.2 和处理器专家将 MFS 和 Shell 包含到 KDS3.0 项目的步骤。 感谢Carlos_Musich提供的出色文档以及本文档的草稿。 此致, 艾萨克·阿维拉 文件系统 回复:如何为 KSDK 和 PEx 项目的新 MQX RTOS 添加 MFS 和 Shell 支持 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 感谢 Isaac 的演讲。 我使用 Shell 和适用于 K60D100M micro 的 shell 创建了 KDS3.0 项目。KSDK 1.2.0。 我遇到的唯一问题是构建变量。 在 Properties\C/C++ Build\Build Variables 中缺少 KSDK_PATH(参见插入的图像)。 我创建了几个任务并在调试器下运行应用程序。调试器下没有 TAD 信息。 我知道,只需查看 TAD 信息,调试器就应该在运行后在任务内部的某个地方停止。 也许你已经解决了这个问题。 谢谢! 列昂尼德·博尔夏克。
View full article
Introducing eRPC This tutorial is introducing the eRPC (embedded remote procedure call) open-source project. The eRPC (Embedded Remote Procedure Call) is a Remote Procedure Call (RPC) system created by NXP. An RPC is a mechanism used to invoke a software routine on a remote system using a simple local function call. The remote system may be any CPU connected by an arbitrary communications channel: a server across a network, another CPU core in a multicore system, and so on. To the client, it is just like calling a function in a library built into the application. The only difference is any latency or unreliability introduced by the communications channel. Important links:  Everything related to the eRPC development is placed GitHub - eRPC base. The eRPC development is placed GitHub - eRPC development.  The eRPC releases are placed GitHub - eRPC Releases. The eRPC documentation is placed Github - eRPC wiki  The eRPC as Python Package on pypi  The eRPC is supporting multicore and multiprocessor types of applications.  Where to find eRPC examples Plenty of eRPC multicore and multiprocessor examples can be found in NXP MCUXpressoSDK packages. Visit https://mcuxpresso.nxp.com to configure, build and download these packages. To get the board list with multicore support (eRPC included) use filtering based on Middleware and search for 'multicore' string. Once the selected package with the multicore middleware is downloaded, see /boards/ /multicore_examples for eRPC multicore examples (RPMsg_Lite or Messaging Unit transports used) or /boards/ /multiprocessor_examples for eRPC multiprocessor examples (UART or SPI transports used). eRPC examples use the 'erpc_' name prefix. Another way of getting NXP MCUXpressoSDK eRPC multicore and multiprocessor examples is using the mcux-sdk Github repo. Follow the description how to use the West tool to clone and update the mcuxsdk repo in readme Overview section. Once done the armgcc eRPC examples can be found in mcuxsdk/examples/ /multicore_examples or in mcuxsdk/examples/ /multiprocessor_examples folders. You can use the evkmimxrt1170 as the board_name for instance. Similar to MCUXpressoSDK packages the eRPC examples use the 'erpc_' name prefix. Re: Introducing eRPC Hello Kunal, it seems your question is addressed here: Need Help-Step by Step procedure to implement eRPC in iMx6sx ? · Issue #5 · EmbeddedRPC/erpc-imx-demos · GitHub  Re: Introducing eRPC HI [email protected]‌, I don't know about official usage of eRPC on MPC5748G. Just the remind: eRPC depends on program language, OS, transport layer. There are not board specific files. So if there is used Freertos and C language you almost win, you need just port transport you want to use (if it is not already). Re: Introducing eRPC Hi Dusan,                    Has eRPC been ported to NXP MPC5748G ? Is there any example code I can reference? Best Regards, Alex Re: Introducing eRPC Hi [email protected], i didn't have big experience in this area. Recently we had to add some mutexes when multiple erpc calls were called from multiple taks. But i like your idea.  I quickly looked into source code. You need to specify your usecase. But i think it is imx Linux vs Mcore using RPSMG. In this case i think you can add mutexes as we did (which will serialize eRPC calls. you would need add them somewhere in performRequest function). The creating endpoints for each thread sounds good to me, but i see more issues which has to be solved. The smaller solution could looks like: transport init function will initialize more endpoints (based on number of tasks), eRPC rpmsg send/receive function on client side change to use unused undepoint to send and same endpoint for receive messages, eRPC rpmsg receive function on server need wait for message on all endpoints. I don't know if it is simple task or more complicated for you. But i am affraid that without modification to code you will be not able to have multithread calls. Re: Introducing eRPC Hi Dusan, I am working with Chandini here at Cubic. I just wanted to get extra info about eRPC when called from multiple threads. At the moment we are using a single end point and using this for one off calls that complete before making the next call. Now we'd potentially like to make multiple calls from multiple threads so we're wondering the best way to do this. In fact with my lack of knowledge here we've tried making other calls concurrently, well we didn't realise we were doing this until there was an issue. Now we see comms failure error codes coming back from the eRPC. Can a single end point be used for this i.e. should this be thread safe on the client side? If not should we use a separate end point for each thread, or should we be doing something else? Regards Lee Re: Introducing eRPC Hi [email protected]‌, Thank you to let us know. It is funny, i read about this today because of another project :smileygrin: Re: Introducing eRPC Hi Dusan, Thanks for the quick response. I could able to achieve better performance(response in microsec) in TCP by disabling the Nagel's algorithm using the below API call on both client and server socket connection. int result = setsockopt(sock,            /* socket affected */                         IPPROTO_TCP,     /* set option at TCP level */                         TCP_NODELAY,     /* name of option */                         (char *) &flag,  /* the cast is historical cruft */                         sizeof(int));    /* length of option value */ Reference : TCP_NODELAY: 2018 Best Practices for TCP Optimization | ExtraHop  Thanks, Sasidharan. Re: Introducing eRPC Hi [email protected]‌, Maybe you can ask guys on github (in same topic, or create new one). There are at least two guys who where doing something with TCP: github: GitHub - EmbeddedRPC/erpc: Embedded RPC  thread1:Server with TCP Transport handling multiple connections · Issue #32 · EmbeddedRPC/erpc · GitHub  thread2:TCP Example client / server code · Issue #39 · EmbeddedRPC/erpc · GitHub  Personaly i found this, but i don't know if this is your case and if it will help: linux - Low latency TCP settings on Ubuntu  Re: Introducing eRPC Hi Dusan, I want to port eRPC over TCP socket. I ran your example test code(test_arrays) over virtual serial(inside linux) and the response time taken for serial is less than 1ms. When I ran the same example code over TCP, the response time is taken for TCP is around 90ms. Is there a way to reduce the latency and increase the performance over TCP as like as serial? Thanks, Sasidharan. Re: Introducing eRPC Hi, Dusan. It helped. By the way it was mentioned in example in header file. The function call from A9 works fine and M4 returns data. But now the issue is when M4 calls function. The error is appears in A9 "Waiting MU transmit buffer empty timeout! ugh, imx_mu_rpmsg_send() failed: -5".  After this error data function call doesn't work in another side too: "rpmsg_multiept rpmsg0: virtqueue_add_outbuf failed: -5" What should I check? Thank you for your help. Re: Introducing eRPC Hi Vadim, Generally yes you need two tasks. One for client and one for server. Issue is also that output from erpc_arbitrated_client_init you have to put as a parameter to init server.  Re: Introducing eRPC Hi Dusan, Marek, community. I've made several applications with eRPC, M4(client)-A9(server) or M4(server)-A9(client) works fine, but I want to use client/server appl on each side. But now it doesn't work or function from one side only executes 1 time and appl hangs. I want to check the general structure of the code. What I do wrong? Should I use 2 separate FreeRTOS tasks for client and server on M4? M4 . . erpc_transport_t transport = erpc_transport_rpmsg_lite_rtos_remote_init(.....); erpc_mbf_t message_buffer_factory = erpc_mbf_rpmsg_init(transport); erpc_server_init(transport, message_buffer_factory); erpc_add_service_to_server(create_TEST_service()); erpc_arbitrated_client_init(transport, message_buffer_factory); while (true) { erpc_server_poll(); function1(....); } A9 . . erpc_transport_t transport = erpc_transport_rpmsg_linux_init(......); erpc_mbf_t message_buffer_factory = erpc_mbf_dynamic_init(); erpc_server_init(transport, message_buffer_factory); erpc_add_service_to_server(create_TEST_service()); erpc_arbitrated_client_init(transport, message_buffer_factory); while (true) { erpc_server_poll(); function2(....); } Re: Introducing eRPC Hi vadimfilippenko, if you are stilll interested in using python version you can look into this thread adding MPU patch to my kernel - I cannot see the new module · Issue #2 · EmbeddedRPC/erpc-imx-demos · GitHub . At least last two messages from mhanuel26 should be interesting for you because he was able to use python application. Re: Introducing eRPC Dusan, Marek, finally I successfully started modified eRPC example. But I use C on Linux side and erpc 1.5.0 with 6x parameters rpmsg init function in M4 (Dusan tips at github concerning 6th parameter). Thank you for help. Be ready for new questions) Re: Introducing eRPC You need to run M4 app befor the python app. Re: Introducing eRPC Hi Vadim, Please post here: ls /sys/class/rpmsg it looks like the nameservice was not sent from the M4 (is M4 running with the right firmware?). Because of this, a folder with dynamically announced channel from M4 was not created and therefore python cannot create rpmsg  transport... Please check your M4 core print-outs. Regards, Marek Re: Introducing eRPC Hi Vadim,  as you see in other comments, i am trying to answer as soon as possible. But this week (and maybe next) i am busy.  But from what i see in error you should compare init function in transport.py - class RpmsgTransport And here erpc-imx-demos/sysfs.py at master · EmbeddedRPC/erpc-imx-demos · GitHub   - class RpmsgEndpoint Be sure that GitHub - EmbeddedRPC/erpc-imx-demos: eRPC demos for i.MX devices  is up to date and and subrepos are checkout on commits as they are aligned with erpc-imx-demos. Maybe mareknovak‌ can help better here what is wrong.  Looks like  if self.id == -1: raise Exception() is returning -1 Re: Introducing eRPC Could anybody help me with follow ussue?: I'm using use eRPC demo example from erpc-imx-demos on iMX6COM board. Starting demo application on M4 side: "Hardware initialized eRPC intialized MatrixMultiply service added" adding driver in linux: "root@imx6sxea-com:~# modprobe -v rpmsg_multiept insmod /lib/modules/4.1.15-2.0.3+geb0b90b/kernel/drivers/rpmsg/rpmsg_multiept.ko" (Here are not any feedback from the system that rpmsg channel was created and rpmsg folder under sys/class/rpmsg is empty) Starting appl demo on linux: Traceback (most recent call last): File "example.py", line 111, in transport = erpc.transport.RpmsgTransport() File "build/bdist.linux-armv7l/egg/erpc/transport.py", line 199, in __init__ File "build/bdist.linux-armv7l/egg/rpmsg/sysfs.py", line 116, in __init__ Exception Exception TypeError: 'an integer is required' in > ignored P.S. I've built M4 eRPC demo appl. using cmake and also eclipse. M4 rpmsg demo appl works fine. Re: Introducing eRPC Hi Vakul, sorry i miss your comment. Currently we don't have any cryptographic transport supported. But because of eRPC is modular, i think you can easily add this feature to your eRPC project. Re: Introducing eRPC Hi Can eRPC communication be protected using some cryptographic transport (e.g. TLS)? Regards Vakul Re: Introducing eRPC Hi Evgeny, currently we have no estimation for that. But i think you can write/use your own allocator by writing your own implementation of erpc_malloc/erpc_free functions. Re: Introducing eRPC Hi Dusan, Are there plans to add more static memory allocation to additional parts, such as generated equivalents of erpcMatrixMultiply_shim? Where every input argument gets dynamically allocated before filling it up with data from the codec and then freed after the function invocation? Something like passing pre-allocated memory (statically by user app) to the framework? Thanks, Evgeny Re: Introducing eRPC Hi Evgeny, this looks like MCUExpresso project files/IDE issue. Top layer of folder names should be virtual directories, which will be not presented there in future. In your package on your disk should eRPC have similar directory structure as on github. Github directory structure is preferred.  Re: Introducing eRPC Hi Dusan, I see that the erpc uses a lot of dynamic memory allocation at run-time. Is there a plan to make it more embedded friendly and add a static memory allocation scheme? EDIT: I am sorry for the first question, i do see the erpc_setup_mbf_static.cpp in the repository. The thing is that i am basing  my code on the examples provided in the MCUXpresso SDK - frdmk66f_multiprocessor_examples_erpc_server_matrix_multiply_spi & frdmk66f_multiprocessor_examples_erpc_client_matrix_multiply_spi. Which have a very different directories structure from the code in the repository.  So my question is, again, should the SDK examples directories structure should be used or the repositories? ANd why are they so different? Thanks, Evgeny  Re: Introducing eRPC Hi Evgeny, first of all: Are you using smac.erpc from develop branch (and app built from that branch)? For me is this version working.  Right now version of erpcgen app and rest of eRPC code is connected. That means if you want use newer erpcgen app you built from github, you should and have to copy github erpc_c/* files from github into your example. After than you can regenerate code with newer erpcgen app, update application (erpc init + transport) functions and everything else should work. Otherwise if you will not update erpc_c files you have to use provided erpcgen app. Look at the bottom of this page: Getting Started · EmbeddedRPC/erpc Wiki · GitHub  Should be pretty up to date for newer erpcgen version. I am not sure but on newest commit spi could get changed so you can use older implementation instead. Re: Introducing eRPC Hey Dusan, When i use the erpcgen.exe that i built, i get the same error on the smac.erpc example: error: file smac.erpc:135:5: syntax error, unexpected identifier, expecting '}' The directory structure that i was referring to is the erpc_c from the repository and: From the SDK example. Which directory structure is the "right" one? Would it be safe to use the newly generated files (by me) with the SDK example code? Thanks, Evgeny Re: Introducing eRPC Hi evgenyerlihman‌, Prefered code is always on github on develop branch. Once this code will meet our requirements for new release we will merge it into master branch and we will provide also binaries of application. These updates on develop branch are more often than releases of Kinetis SDK. If some existing eRPC transport will not met version with transport used in Kinetis SDK you can compare old eRPC transport with newer one, or look on file changes in git repository. Re: Introducing eRPC Hey dusancervenka-b51352, Thank you for the quick reply! I cloned the dev branch. I see that the erpc_c directory structure is way different than the example provided with the Kinetis SDK. Which one is preferable? Thanks, Evgeny Re: Introducing eRPC Hi evgenyerlihman‌, Actually we are doing updates more frequently. You need switch to develop branch. GitHub - EmbeddedRPC/erpc at develop. Last code update was yesterday. But you need build erpcgen application there. With that smac IDL should works.  Re: Introducing eRPC Hi dusancervenka-b51352, I am considering using the erpc framework for a new product i am working on, that uses multiple nxp kinetis devices. I see that last updates to erpc github were made 6 months ago. My question is, is it still being maintained/fixed/developed? I tried the example from github: erpcgen.exe smac.erpc And it failed to generate the cpp source code with an error. The erpcgen executable is from the SDK for MCUXpresso. Thanks, Evgeny Re: Introducing eRPC Hi Chandini, It is ok. I was on long holiday too. I hope you enjoyed it well.  I sent you email through community messaging system (private message). We can discuss details through emails. Basically you ned create fork on github, checkout to develop branch, apply your changes, create commit, create pull request. We will review your changes, suggest changes and merge to develop branch. Re: Introducing eRPC Hi Dusan , Very sorry for late response , i was on long holiday . came back now . spoke with my everyone here .  could you please send me your email id so that we will forward stuff for you . according to our company we cant put anything directly to your github . Thank you Chandini  Re: Introducing eRPC Hi Dusan , Sure , i will talk to my seniors and create pull request  . currently i am on holiday .Sorry for the late reply. Thank you Chandini Re: Introducing eRPC Hi Chandini. We are glad you have succeeded. If i can have one special proposal for you, could you send pull request on develop branch on eRPC github with your newly created transport layer (on develop branch). Maybe there will be some work to get it working with newer eRPC. But if you not want updated it i can do that  With pull request on github you will be valuable contributor always seen in contributor's history. I hope eRPC will be good solution for you. And we are always here/ or on github for you Re: Introducing eRPC Hi dusancervenka-b51352 , b50844 , novakma7   Finally got it working , now demo working fine with my c++ code in Linux . Thanks a lot guys for answering all my questions. Special thanks to Dusan  Thank you Chandini Re: Introducing eRPC HI Dusan , As i was busy in some other task , Yesterday i could not try anything . today i will try and let you know . I think i have to change my functions little bit and need to try . because till now i was passing just char* to my send and receive functions. Come back to you soon. Thank you Chandini Re: Introducing eRPC Hi Chandini, yes that is correct. I was outside of company, so i didn't know exact names for functions. Is it working for you? Re: Introducing eRPC Hi Dusan Thank you for your reply : write(fd, message->getBuffer(), message->getUsed()😞 I can see getused function in  erpc/message_buffer.h at 9e18d069aeae19a6e80a5e8783903bc63bd9b567 · EmbeddedRPC/erpc · GitHub  but could not find getbuffer function. I think i have to use below function to get my buffer ? is that right ? /*! * @brief This function returns pointer to buffer to read/write. * * @return Pointer to buffer to read/write. */ uint8_t *get() { return m_buf; } so my functions becomes like this: send :erpc_status_t send(MessageBuffer *message) { write(fd, message->get, message->getUsed())};  Thank you chandini Re: Introducing eRPC Hi chanidi, well you need do it in diferent way 😕 You have to use transport.h. It will not work if you will not use that.  Maybe you can use ioctl commands as i mentioned above: erpc_status_t receive(MessageBuffer *message) {int fd = open("/dev/rpmsg_ept1024.1", O_RDWR);} send :erpc_status_t send(MessageBuffer *message) { write(fd, message->getBuffer(), message->getUsed())}; read: erpc_status_t receive(MessageBuffer *message){size_t size = read(fd, message->getBuffer(), 500); message->setUsed(size)}; novakma7 Can you confirm steps? Re: Introducing eRPC Dusan , Marek Ya i am referring those files as well , but i am using trasport.h to create my transport layer. but facing argument miss-match  problem send and receive functions in transport.h , take Messagebuffer as argument,          virtual erpc_status_t receive(MessageBuffer *message) = 0;          virtual erpc_status_t send(MessageBuffer *message) = 0; As per example.py i have created my RpmsgEndpoint class which need below arguments       RpmsgEndpoint::receive(int maxlen)       RpmsgEndpoint::send(char *buffer,int dst) As per my understanding, we are just need to read and write /dev/rpmsg_ept1024.1 device from Linux .   So i think instead of using transport.h , i think should i need to create my own transport.h version ,? Thank you guys Chandini Re: Introducing eRPC You are welcome. You can get inspirations in /erpc-imx-demos/middleware/erpc/transport/ folder. There is several transports. Re: Introducing eRPC Thanks a lot Dusan for quick reply , i will continue in the same path then and come back to u shortly .  Re: Introducing eRPC Hi Chandini. You are right. That are correct steps. You need create your class which is inheriting class from transport.h Re: Introducing eRPC Hi Marek I have question again . Currently my working status  : i got RpmsgEndpoint class in c++ I am working on how to make my client application working now. Python  example.py in erpc-imx-demos/MPU/example_erpc at master · EmbeddedRPC/erpc-imx-demos · GitHub  call  RpmsgTransport which inherited from Transport class. Question i have is , shall i use transport.h which is inside /erpc-imx-demos/middleware/erpc/erpc_c/infra  to make my application work. So that i can create my RpmsgTransport class and call it my client application . Am i thinking correctly ?  Thank you in advance Chandini Re: Introducing eRPC Yes, you are right. All the Python does are just IO operations on the files (read/write). This is doable in any language, including C/C++. Python was selected to show how it can be done due to its popularity in Linux user-space, but you can certainly port it to C. I think we are on the same wavelenght now, Good luck! Regards, Marek Re: Introducing eRPC Hi Marek Thank you for your reply , it cleared few of my doubts. We are not planning to use freeRTOS on both side. Our plan is   M4- FreeRTOS ----This we have it in your Demo A7-Linux -----Your Demo got python code , to make use of kernel RPMSG implemenation   All we need is instead of python either C or C++. I think  we can port  python code to C or C++ , easily right ? Thank you Chandini Re: Introducing eRPC Hi Chandini Indavara Basavaraju, RPMSg-Lite is implementation of RPMsg protocol and is intended only for the M4 side running FreeRTOS or baremetal. On the Linux/A7 side, you should be fine with the RPMsg implementation in kernel. (like here: GitHub - EmbeddedRPC/erpc-imx-demos: eRPC demos for i.MX devices  ) Or are you planning to run FreeRTOS on both M4 and A7 cores? In that case it would work, but this is not a standard use-case. It would require you to create a porting layer for the A core and to make FreeRTOS run there.  I hope this gives you some direction, Marek Re: Introducing eRPC Hi Marek Some how i have missed your message , sorry for that thanks a lot . i will try your new version soon. Could you please answer my last question regarding RPMSG transport layer ? Thank you  Chandini Re: Introducing eRPC Hi, i understand you.  You need create new one (and with pull request on github you can add it to our repository if you want). On Linux side you can use /dev/ttyRPMSG (if it is present in system).   for example create new transport here erpc_c/transports with: init can looks like:  int fd = open("/dev/ttyRPMSG", O_RDWR); send : write(fd, buffer, buffer_size); read: size_t size = read(fd, buffer, expected size); If there is no device named like this, you can be inspired from python code. RPMSG is not my cup of tea. I don't know how it should be used on Linux. I will forward your question to Marek. Re: Introducing eRPC Hi Dusan , Marek What i am planning : use rpmsg-lite on both M4(freertos) and A7(Linux) What i need: RPMSG C warrper (under erpc_c/setup) which can be use on both M4 and A7 side RPMSG Transport Layer (under erpc_c/transports) which can be use on both M4 and A7 side Questions i have: Could please tell me , Do you have any transport layer for that ?    or Do we need to refer rpmsg-python and write similar like that ?  Any suggestions will be so helpful Thank you guys Chandini Re: Introducing eRPC Hi, i am not sure if we have what you need (c transport for Linux side). But it should be easy to create new one. You can read and write from/to /dev/ttyRPMSG (if it is present in system). for example: init can looks like:  int fd = open("/dev/ttyRPMSG", O_RDWR); send : write(fd, buffer, buffer_size); read: size_t size = read(fd, buffer, expected size); mareknovak can brings more sun into this issue. Re: Introducing eRPC Hi Dusan , thank you for letting me know about update. I thiink now i am ok with erpc what i have shortly , once i got rpmsg Client application working then i can update erpc version as well. I was started looking rpmsg-lite , that got M4 platform files . i wonder do have anything for A7 platform ? or any information will be so helpful. my main aim is to get Client  Application using C with RPMSg as Transport layer Thank you Chandini Re: Introducing eRPC I am happy that you are progressing independently with your issue (for us it means it is not too much complicated for developers). Also mareknovak already updated his imx demo application inside the repository as he mentioned in few comments above. Your next step can be used that version because it is using new rpc features Re: Introducing eRPC Thank you for reply Dusan  that was the information i was looking for, i have created C wrapper for TCP  , after couple of fixes in erpc,  it works fine . My next step is to replace TCP layer with rpmsg . Thank you again Chandini Re: Introducing eRPC Hi Chandini Indavara Basavaraju, I have just updated the GitHub - EmbeddedRPC/erpc-imx-demos: eRPC demos for i.MX devices  repository to use eRPC 1.4.0 and RPMSg-Lite 1.1.0. You can download a pre-built erpcgen application, which is used for code generation here: Release v1.4 · EmbeddedRPC/erpc · GitHub  in the downloads section, just choose your architecture. Then you invoke it like this: ./erpcgen -gpy nameOfInterfaceDefinitionLanguageFile.erpc, this will generate Python serialization and deserialization shim code for you. If you omit -gpy or specify -gc, you will get C shim code. The ser/des shim code was also update in the latest commit in the erpc-imx-demos repository, so feel free to use it. Feel free to submit your changes in form of a pull-request, Regards and thank you for using eRPC & RPMsg-Lite! Marek Re: Introducing eRPC Hi, we don't have currently example on github repository. But we have C(c++) test there. If you are familiar with Linux or Mac you can use that as a example. Other options are as described above: 1. Download sdk for supported board -> multicore/multiprocessor c/python examples. 2. Read this article: Getting Started · EmbeddedRPC/erpc Wiki · GitHub  Re: Introducing eRPC Hi Dusan Could you please tell me , do u have any client application c example instead of python .? or Do you guys are planning to write one ?it will be so useful and helpful, if you have one already. Thank you in advance Chandini Re: Introducing eRPC Finally i got it working , thank a lot for you help   Dusan sorry i could not find attach option to attach my patch . so pasted below. From 7a5b152524a3c82b5bced4a72ed396f21860b666 Mon Sep 17 00:00:00 2001 Date: Mon, 8 May 2017 11:33:05 +0100 Subject: [PATCH] fix to run eRPC_demo --- erpc_c/infra/transport.h | 4 +- erpc_c/setup/erpc_server_setup.cpp | 36 ++++- erpc_c/setup/erpc_server_setup.h | 2 +- erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp | 54 +++++++ erpc_c/setup/erpc_transport_setup.h | 18 ++- erpc_c/transports/rpmsg_lite_rtos_transport.cpp | 158 ++++++++++++++++++ erpc_c/transports/rpmsg_lite_rtos_transport.h | 177 +++++++++++++++++++++ erpc_c/transports/rpmsg_rtos_transport.h | 147 +++++++++++++++++ erpc_python/erpc/transport.py | 21 +++ 9 files changed, 602 insertions(+), 15 deletions(-) create mode 100644 erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp create mode 100644 erpc_c/transports/rpmsg_lite_rtos_transport.cpp create mode 100644 erpc_c/transports/rpmsg_lite_rtos_transport.h create mode 100644 erpc_c/transports/rpmsg_rtos_transport.h diff --git a/erpc_c/infra/transport.h b/erpc_c/infra/transport.h index eb7ec71..fd4862a 100644 --- a/erpc_c/infra/transport.h +++ b/erpc_c/infra/transport.h @@ -48,7 +48,7 @@ //////////////////////////////////////////////////////////////////////////////// namespace erpc { - +class MessageBuffer; /*! * @brief Abstract interface for transport layer. * @@ -89,7 +89,7 @@ public: * * @return based on send implementation. */ - virtual erpc_status_t send(MessageBuffer *message) = 0; + virtual erpc_status_t send(const MessageBuffer *message) = 0; /*! * @brief Poll for an incoming message. diff --git a/erpc_c/setup/erpc_server_setup.cpp b/erpc_c/setup/erpc_server_setup.cpp index 51fa799..5cd4346 100644 --- a/erpc_c/setup/erpc_server_setup.cpp +++ b/erpc_c/setup/erpc_server_setup.cpp @@ -33,8 +33,10 @@ #include "basic_codec.h" #include "manually_constructed.h" #include "simple_server.h" -#include +#include "message_buffer.h" +#include "erpc_config_internal.h" #include +#include #if !(__embedded_cplusplus) using namespace std; @@ -43,6 +45,29 @@ using namespace std; using namespace erpc; //////////////////////////////////////////////////////////////////////////////// +// Classes +//////////////////////////////////////////////////////////////////////////////// + +class BasicMessageBufferFactory : public MessageBufferFactory +{ +public: + virtual MessageBuffer create() + { + uint8_t *buf = new (nothrow) uint8_t[ERPC_DEFAULT_BUFFER_SIZE]; + return MessageBuffer(buf, ERPC_DEFAULT_BUFFER_SIZE); + } + + virtual void dispose(MessageBuffer *buf) + { + assert(buf); + if (*buf) + { + delete[] buf->get(); + } + } +}; + +//////////////////////////////////////////////////////////////////////////////// // Variables //////////////////////////////////////////////////////////////////////////////// @@ -50,29 +75,32 @@ using namespace erpc; static ManuallyConstructed s_server; SimpleServer *g_server; +static ManuallyConstructed s_msgFactory; static ManuallyConstructed s_codecFactory; //////////////////////////////////////////////////////////////////////////////// // Code //////////////////////////////////////////////////////////////////////////////// -void erpc_server_init(erpc_transport_t transport, erpc_mbf_t message_buffer_factory) +void erpc_server_init(erpc_transport_t transport) { // Init factories. + s_msgFactory.construct(); s_codecFactory.construct(); // Init server with the provided transport. s_server.construct(); s_server->setTransport(reinterpret_cast (transport)); + s_server->setMessageBufferFactory(s_msgFactory); s_server->setCodecFactory(s_codecFactory); - s_server->setMessageBufferFactory(reinterpret_cast (message_buffer_factory)); g_server = s_server; } - void erpc_server_deinit() { + s_msgFactory.destroy(); s_codecFactory.destroy(); s_server.destroy(); + } void erpc_add_service_to_server(void *service) diff --git a/erpc_c/setup/erpc_server_setup.h b/erpc_c/setup/erpc_server_setup.h index 8e6a6ef..e4e9eaa 100644 --- a/erpc_c/setup/erpc_server_setup.h +++ b/erpc_c/setup/erpc_server_setup.h @@ -60,7 +60,7 @@ extern "C" { * * This function initializes server with all components necessary for running server. */ -void erpc_server_init(erpc_transport_t transport, erpc_mbf_t message_buffer_factory); +void erpc_server_init(erpc_transport_t transport); /*! * @brief This function de-initializes server. diff --git a/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp new file mode 100644 index 0000000..b480d42 --- /dev/null +++ b/erpc_c/setup/erpc_setup_rpmsg_lite_rtos_remote.cpp @@ -0,0 +1,54 @@ + /* + * Copyright (c) 2014-2016, Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "manually_constructed.h" +#include "rpmsg_lite_rtos_transport.h" +#include "erpc_transport_setup.h" + +using namespace erpc; + +//////////////////////////////////////////////////////////////////////////////// +// Variables +//////////////////////////////////////////////////////////////////////////////// + +static ManuallyConstructed s_transport; + +//////////////////////////////////////////////////////////////////////////////// +// Code +//////////////////////////////////////////////////////////////////////////////// + +erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init( + unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, void (*ready_cb)(void), bool send_nameservice) +{ + s_transport.construct(); + s_transport->init(src_addr, dst_addr, start_address, rpmsg_link_id, ready_cb, send_nameservice); + return reinterpret_cast (s_transport.get()); +} + + diff --git a/erpc_c/setup/erpc_transport_setup.h b/erpc_c/setup/erpc_transport_setup.h index 798d92f..6c3959e 100644 --- a/erpc_c/setup/erpc_transport_setup.h +++ b/erpc_c/setup/erpc_transport_setup.h @@ -34,6 +34,7 @@ #include "erpc_version.h" #include +#include /*! * @addtogroup transport_setup @@ -48,7 +49,7 @@ //! @brief Opaque transport object type. typedef struct ErpcTransport *erpc_transport_t; //! @brief Ready callback object type for RPMsg-Lite transport. -typedef void (*rpmsg_ready_cb)(void); +//typedef void (*rpmsg_ready_cb)(void); //////////////////////////////////////////////////////////////////////////////// // API @@ -106,21 +107,21 @@ erpc_transport_t erpc_transport_rpmsg_lite_master_init(unsigned long src_addr, /*! * @brief Create an RPMsg-Lite zero copy transport. */ -erpc_transport_t erpc_transport_rpmsg_lite_zc_master_init(unsigned long src_addr, - unsigned long dst_addr, - int rpmsg_link_id); +//erpc_transport_t erpc_transport_rpmsg_lite_zc_master_init(unsigned long src_addr, +// unsigned long dst_addr, +// int rpmsg_link_id); /*! * @brief Create an RPMsg-Lite transport. */ erpc_transport_t erpc_transport_rpmsg_lite_remote_init( - unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready); + unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, void (*ready_cb)(void), bool send_nameservice); /*! * @brief Create an RPMsg-Lite zero copy transport. */ -erpc_transport_t erpc_transport_rpmsg_lite_zc_remote_init( - unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready); +//erpc_transport_t erpc_transport_rpmsg_lite_zc_remote_init( +// unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready); /*! * @brief Create an RPMsg-Lite RTOS transport. @@ -133,7 +134,8 @@ erpc_transport_t erpc_transport_rpmsg_lite_rtos_master_init(unsigned long src_ad * @brief Create an RPMsg-Lite RTOS transport. */ erpc_transport_t erpc_transport_rpmsg_lite_rtos_remote_init( - unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, rpmsg_ready_cb ready); + unsigned long src_addr, unsigned long dst_addr, void *start_address, int rpmsg_link_id, void (*ready_cb)(void), bool send_nameservice); + //@} diff --git a/erpc_c/transports/rpmsg_lite_rtos_transport.cpp b/erpc_c/transports/rpmsg_lite_rtos_transport.cpp new file mode 100644 index 0000000..e04ae91 --- /dev/null +++ b/erpc_c/transports/rpmsg_lite_rtos_transport.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "rpmsg_lite_rtos_transport.h" +#include + +#if !(__embedded_cplusplus) +using namespace std; +#endif + +using namespace erpc; + +//////////////////////////////////////////////////////////////////////////////// +// Variables +//////////////////////////////////////////////////////////////////////////////// +uint8_t RPMsgRTOSTransport::s_initialized = 0; +struct rpmsg_lite_instance *RPMsgRTOSTransport::s_rpmsg; + +//////////////////////////////////////////////////////////////////////////////// +// Code +//////////////////////////////////////////////////////////////////////////////// + +RPMsgRTOSTransport::RPMsgRTOSTransport() +: Transport() +, m_dst_addr(0) +{ +} + +RPMsgRTOSTransport::~RPMsgRTOSTransport() +{ + rpmsg_lite_deinit(s_rpmsg); + s_initialized = 0; +} + +erpc_status_t RPMsgRTOSTransport::init( + unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, int rpmsg_link_id) +{ + if (!s_initialized) + { + s_rpmsg = rpmsg_lite_master_init(base_address, length, rpmsg_link_id, RL_NO_FLAGS); + s_initialized = 1; + } + + m_rpmsg_queue = rpmsg_queue_create(s_rpmsg); + m_rpmsg_ept = rpmsg_lite_create_ept(s_rpmsg, src_addr, rpmsg_queue_rx_cb, m_rpmsg_queue); + + m_dst_addr = dst_addr; + return m_rpmsg_ept == RL_NULL ? kErpcStatus_InitFailed : kErpcStatus_Success; +} + +erpc_status_t RPMsgRTOSTransport::init( + unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id, void (*ready_cb)(void), bool send_nameservice) +{ + if (!s_initialized) + { + s_rpmsg = rpmsg_lite_remote_init(base_address, rpmsg_link_id, RL_NO_FLAGS); + + /* Signal the other core we are ready */ + if (ready_cb != NULL) + { + ready_cb(); + } + + while (!rpmsg_lite_is_link_up(s_rpmsg)) + { + } + + s_initialized = 1; + } + + m_rpmsg_queue = rpmsg_queue_create(s_rpmsg); + m_rpmsg_ept = rpmsg_lite_create_ept(s_rpmsg, src_addr, rpmsg_queue_rx_cb, m_rpmsg_queue); + + if(send_nameservice) + { + rpmsg_ns_announce(s_rpmsg, m_rpmsg_ept, + "rpmsg-openamp-demo-channel", + 0); + } + + m_dst_addr = dst_addr; + return m_rpmsg_ept == RL_NULL ? kErpcStatus_InitFailed : kErpcStatus_Success; +} + +erpc_status_t RPMsgRTOSTransport::receive(MessageBuffer *message) +{ + int ret_val = rpmsg_queue_recv(s_rpmsg, m_rpmsg_queue, &m_dst_addr, (char *)message->get(), kRpmsgMessageBufferSize, + NULL, RL_BLOCK); + return ret_val != RL_SUCCESS ? kErpcStatus_ReceiveFailed : kErpcStatus_Success; +} + +erpc_status_t RPMsgRTOSTransport::send(const MessageBuffer *message) +{ + int ret_val = + rpmsg_lite_send(s_rpmsg, m_rpmsg_ept, m_dst_addr, (char *)message->get(), message->getUsed(), RL_BLOCK); + return ret_val != RL_SUCCESS ? kErpcStatus_SendFailed : kErpcStatus_Success; +} + +MessageBuffer RPMsgMessageBufferFactory::create() +{ + uint8_t idx = 0; + while (((m_freeBufferBitmap & idx) == 0) && (idx < kInitCountMessageBuffers)) + { + idx++; + } + + assert(idx < kInitCountMessageBuffers); + + m_freeBufferBitmap &= ~(1 << idx); + + uint8_t *buf; + buf = m_buffers[idx]; + + assert(NULL != buf); + return MessageBuffer(buf, kRpmsgMessageBufferSize); +} + +void RPMsgMessageBufferFactory::dispose(MessageBuffer *buf) +{ + assert(buf); + uint8_t *tmp = buf->get(); + + if (tmp) + { + uint8_t idx = 0; + while ((tmp != m_buffers[idx]) && (idx < kInitCountMessageBuffers)) + { + ++idx; + } + m_freeBufferBitmap |= 1 << idx; + } +} diff --git a/erpc_c/transports/rpmsg_lite_rtos_transport.h b/erpc_c/transports/rpmsg_lite_rtos_transport.h new file mode 100644 index 0000000..f1aec8a --- /dev/null +++ b/erpc_c/transports/rpmsg_lite_rtos_transport.h @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2015-2016, Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _EMBEDDED_RPC__RPMSG_LITE_RTOS_TRANSPORT_H_ +#define _EMBEDDED_RPC__RPMSG_LITE_RTOS_TRANSPORT_H_ + +#include "transport.h" +#include "message_buffer.h" +#include "rpmsg_lite.h" +#include "rpmsg_queue.h" +#include "rpmsg_ns.h" + +/*! + * @addtogroup rpmsg_lite_rtos_transport + * @{ + * @file + */ + +//////////////////////////////////////////////////////////////////////////////// +// Definitions +//////////////////////////////////////////////////////////////////////////////// + +enum +{ + kRpmsgMessageBufferSize = RPMSG_BUFFER_SIZE, + kInitCountMessageBuffers = 2, +}; + +//////////////////////////////////////////////////////////////////////////////// +// Classes +//////////////////////////////////////////////////////////////////////////////// + +namespace erpc +{ +/*! + * @brief Transport that uses RPMsg RTOS API for interprocessor messaging. + * + * @ingroup rpmsg_lite_rtos_transport + */ +class RPMsgRTOSTransport : public Transport +{ +public: + /*! + * @brief Constructor. + * + * This function initializes object attributes. + */ + RPMsgRTOSTransport(); + + /*! + * @brief RPMsgRTOSTransport destructor + */ + virtual ~RPMsgRTOSTransport(); + + /*! + * @brief This function call RPMsg rtos init function - as RPMsg master + * + * @Param[in] src_addr Source address. + * @Param[in] dst_addr Destination address. + * @Param[in] base_address RPMsg base address in the shared memory. + * @Param[in] length RPMsg shared memory region length. + * @Param[in] rpmsg_link_id Selection between what cores the communication will occur. + * + * @retval kErpcStatus_Success When rpmsg init function was executed successfully. + * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. + */ + virtual erpc_status_t init( + unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, int rpmsg_link_id); + + /*! + * @brief This function call RPMsg rtos init function - as RPMsg remote + * + * @Param[in] src_addr Source address. + * @Param[in] dst_addr Destination address. + * @Param[in] base_address RPMsg base address in the shared memory. + * @Param[in] rpmsg_link_id Selection between what cores the communication will occur. + * @Param[in] ready_cb Callback called after RPMsg init is done and the core is ready. + * @Param[in] send_nameservice If true, RPMsg master notified by nameservice. + * + * @retval kErpcStatus_Success When rpmsg init function was executed successfully. + * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. + */ + virtual erpc_status_t init( + unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id, void (*ready_cb)(void), bool send_nameservice); + + /*! + * @brief Store incoming message to message buffer. + * + * In loop while no message come. + * + * @Param[in] message Message buffer, to which will be stored incoming message. + * + * @retval kErpcStatus_ReceiveFailed Failed to receive message buffer. + * @retval kErpcStatus_Success Successfully received all data. + */ + virtual erpc_status_t receive(MessageBuffer *message); + + /*! + * @brief Function to send prepared message. + * + * @Param[in] message Pass message buffer to send. + * + * @retval kErpcStatus_SendFailed Failed to send message buffer. + * @retval kErpcStatus_Success Successfully sent all data. + */ + virtual erpc_status_t send(const MessageBuffer *message); + +protected: + /* Remote device */ + struct remote_device *m_rdev; /*!< Device which represent the second core. */ + struct rpmsg_channel *m_app_rp_chnl; /*!< Represent connection between two device (two cores). */ + unsigned long m_dst_addr; /*!< Destination address used by rpmsg. */ + rpmsg_queue_handle m_rpmsg_queue; /*!< Handle of RPMsg queue. */ + struct rpmsg_lite_endpoint *m_rpmsg_ept; /*!< Pointer to RPMsg Lite Endpoint structure. */ + + static struct rpmsg_lite_instance *s_rpmsg; /*!< Pointer to instance of RPMSG lite. */ + static uint8_t s_initialized; /*!< Represent information if the rpmsg-lite was initialized. */ +}; + +class RPMsgMessageBufferFactory : public MessageBufferFactory +{ + uint8_t m_freeBufferBitmap; + uint8_t m_buffers[kInitCountMessageBuffers][kRpmsgMessageBufferSize]; + +public: + /*! + * @brief Constructor. + */ + RPMsgMessageBufferFactory() + : m_freeBufferBitmap(0xFF) + { + } + /*! + * @brief RPMsgMessageBufferFactory destructor + */ + virtual ~RPMsgMessageBufferFactory() {} + /*! + * @brief This function create message buffer used for communication between devices. + */ + virtual MessageBuffer create(); + /*! + * @brief This function dispose message buffer used for communication between devices. + */ + virtual void dispose(MessageBuffer *buf); +}; + +} // namespace erpc + +/*! @} */ + +#endif // _EMBEDDED_RPC__RPMSG_LITE_RTOS_TRANSPORT_H_ diff --git a/erpc_c/transports/rpmsg_rtos_transport.h b/erpc_c/transports/rpmsg_rtos_transport.h new file mode 100644 index 0000000..ad1d229 --- /dev/null +++ b/erpc_c/transports/rpmsg_rtos_transport.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2015, Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * o Redistributions of source code must retain the above copyright notice, this list + * of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * o Neither the name of Freescale Semiconductor, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _EMBEDDED_RPC__RPMSG_RTOS_TRANSPORT_H_ +#define _EMBEDDED_RPC__RPMSG_RTOS_TRANSPORT_H_ + +#include "transport.h" +#include "message_buffer.h" + +extern "C" { +#include "rpmsg.h" +#include "rpmsg_rtos.h" +#include "rpmsg.h" +} + +/*! + * @addtogroup rpmsg_rtos_transport + * @{ + * @file + */ + +//////////////////////////////////////////////////////////////////////////////// +// Definitions +//////////////////////////////////////////////////////////////////////////////// + +enum +{ + kRpmsgMessageBufferSize = RPMSG_BUFFER_SIZE, +}; + +//////////////////////////////////////////////////////////////////////////////// +// Classes +//////////////////////////////////////////////////////////////////////////////// + +namespace erpc +{ +/*! + * @brief Transport that uses RPMsg RTOS API for interprocessor messaging. + * + * @ingroup rpmsg_rtos_transport + */ +class RPMsgRTOSTransport : public Transport +{ +public: + /*! + * @brief Constructor. + * + * This function initializes object attributes. + */ + RPMsgRTOSTransport(); + + /*! + * @brief RPMsgRTOSTransport destructor + */ + virtual ~RPMsgRTOSTransport(); + + /*! + * @brief This function call rpmsg rtos init function. + * + * @Param[in] dev_id Device id number. + * @Param[in] role Device role number. + * + * @retval kErpcStatus_Success When rpmsg init function was executed successfully. + * @retval kErpcStatus_InitFailed When rpmsg init function wasn't executed successfully. + */ + virtual erpc_status_t init(int dev_id, int role); + + /*! + * @brief Store incoming message to message buffer. + * + * In loop while no message come. + * + * @Param[in] message Message buffer, to which will be stored incoming message. + * + * @retval kErpcStatus_ReceiveFailed Failed to receive message buffer. + * @retval kErpcStatus_Success Successfully received all data. + */ + virtual erpc_status_t receive(MessageBuffer *message); + + /*! + * @brief Function to send prepared message. + * + * @Param[in] message Pass message buffer to send. + * + * @retval kErpcStatus_SendFailed Failed to send message buffer. + * @retval kErpcStatus_Success Successfully sent all data. + */ + virtual erpc_status_t send(const MessageBuffer *message); + +protected: + /* Remote device */ + static struct remote_device *m_rdev; /*!< Device which represent the second core. */ + static struct rpmsg_channel *m_app_rp_chnl; /*!< Represent connection between two device (two cores). */ +}; + +class RPMsgMessageBufferFactory : public MessageBufferFactory +{ +public: + /*! + * @brief Constructor. + */ + RPMsgMessageBufferFactory() {} + /*! + * @brief RPMsgMessageBufferFactory destructor + */ + virtual ~RPMsgMessageBufferFactory() {} + /*! + * @brief This function create message buffer used for communication between devices. + */ + virtual MessageBuffer create(); + /*! + * @brief This function dispose message buffer used for communication between devices. + */ + virtual void dispose(MessageBuffer *buf); +}; + +} // namespace erpc + +/*! @} */ + +#endif // _EMBEDDED_RPC__RPMSG_RTOS_TRANSPORT_H_ diff --git a/erpc_python/erpc/transport.py b/erpc_python/erpc/transport.py index 0765e9f..c335943 100644 --- a/erpc_python/erpc/transport.py +++ b/erpc_python/erpc/transport.py @@ -31,6 +31,8 @@ import struct import serial +from rpmsg.sysfs import RpmsgEndpoint +import time import socket import threading from .crc16 import crc16 @@ -107,6 +109,25 @@ class SerialTransport(FramedTransport): class ConnectionClosed(Exception): pass +class RpmsgTransport(Transport): + def __init__(self): + self.ept = RpmsgEndpoint( + RpmsgEndpoint.rpmsg_openamp_channel, + RpmsgEndpoint.LOCAL_DEFAULT_ADDRESS, + RpmsgEndpoint.Types.DATAGRAM) + + def send(self, message): + self.ept.send(message, RpmsgEndpoint.REMOTE_DEFAULT_ADDRESS) + + def receive(self): + while True: + ret = self.ept.recv(2048) + if len(ret[1]) != 0: + return ret[1] + else: + time.sleep(0.001) + return ret[1] + class TCPTransport(FramedTransport): def __init__(self, host, port, isServer): super(TCPTransport, self).__init__() -- 2.7.4 Re: Introducing eRPC Thank you Dusan . once i got my demo working , i will create pull request .. Thanks again for your reply , i got python files . i will run demo and come back to u shortly . Re: Introducing eRPC Hi, great work  If you want you can create pull request for imx demo repository to fix it. mareknovak can review it and merge it to the repository. To generate python code: As other application you can do in command line "erpcgen --help (-h should work too)". python -gpy idl_file -> gpy means generate python. Re: Introducing eRPC That's cool, i can continue to work in the same stable version until update .  with couples of fixes my MCU demo build and run properly now ..Thanks for your information Re: Introducing eRPC Hi Dusan I did fix and now i got MCU demo working properly ... Thanks for pointing out me a stable version .. Could you please tell me How to generate python code using erpcgen tool ..  ? Thank you Chandini Re: Introducing eRPC Hi, not sooner than tomorrow. But i can't promise that it will be tomorrow. My colleague mareknovak is not in work today. But it should be soon. Re: Introducing eRPC Could you please tell me , when are you going to update ?  Re: Introducing eRPC Hi thanks for you interest. Then it looks like the erpc generated files were generated with different erpcgen then on commit Marek provided (our mistake). Best solution looks like we need updated that demo with latests stable erpc and erpcgen version. You can try this from master branch GitHub - EmbeddedRPC/erpc: Embedded RPC (and there is erpcgen prebuilt 1.4.0). But i don't know how much changes you need to do. Or you can wait for our update. mareknovak Re: Introducing eRPC Hi Dusan I was using  same eRPC library one which u refereed  Steps i followed are below: Clone  erpc-imx-demos including sub module(which clone eRPC GitHub - MarekNovakNXP/erpc at 232afb209f0a0cfceb25a1be11879f7d1934e065  ) 1. git clone --recursive https://github.com/EmbeddedRPC/erpc-imx-demos.git 2. go to erpc-imx-demos/middleware/erpc folder and build erpcgen like this: installed required packages flex/bison and boost make eprc make eprcgen sudo make install successfully got erpcgen  3. Tried create my own output files using same erpc_matrix_multiply.erpc like this : erpcgen -I erpc-imx-demos/MCU/example_erpc/service -o test/erpc-imx-demos/MCU/example_erpc/service erpc_matrix_multiply.erpc successfully got below files: erpc_matrix_multiply.h erpc_matrix_multiply_server.cpp erpc_matrix_multiply_server.h erpc_matrix_multiply_client.cpp 4. Tried to build  MCU/example_erpc/build/armgcc/imx7d_sdb_m4/build_all.sh failed with error : /home/basavarajuc/test/erpc-imx-demos/MCU/example_erpc/service/erpc_matrix_multiply_server.cpp: In function 'void* create_MatrixMultiplyService_service()': /home/basavarajuc/test/erpc-imx-demos/MCU/example_erpc/service/erpc_matrix_multiply_server.cpp:168:56: error: invalid new-expression of abstract class type 'MatrixMultiplyService_service' return new (nothrow) MatrixMultiplyService_service(); Sorry for asking again , just to clarify my understanding . 1.if i am using eRPC library from GitHub - MarekNovakNXP/erpc at 232afb209f0a0cfceb25a1be11879f7d1934e065 then Do i need to update demo ? to run demo successfully  2. Could you please tell me  output files from erpc-imx-demos/MCU/example_erpc/service at master · EmbeddedRPC/erpc-imx-demos · GitHub  are generated by which erpcgen version ? So that i can use old erpcgen shortly to create my own files  Thanks a lot . and sorry for disturbance  Chandini   Re: Introducing eRPC Hi and thanks for your comment.  Example you mentioned is an older version than your erpcgen build. mareknovak also created his fork of official eRPC repository due to some minor changes which were not present in an official release at that time. If you click on eRPC reference from erpc-imx-demos repository from middleware folder, you will be redirect to his eRPC repository. You need build erpcgen from that version. We want update demo in the future.  Hope i helped you. If you have any concerns don't hesitate and ask us.  Re: Introducing eRPC Hi Sorry if i am asking basic question. I am trying to understand how to use erpcgen tool from NXP. I successfully ran example demo , with reference : https://github.com/EmbeddedRPC/erpc-imx-demos My next approach  was build erpcgen  and create my own output files using same erpc_matrix_multiply.erpc and run same demo again so i get familiar to use erpcgen tool. i got output files but even though i am using same erpc_matrix_multiply.erpc my files different than example files the changes are : Output files in example demo says (erpc_matrix_multiply_server.h): erpc_status_t erpcMatrixMultiply_shim(erpc::Codec * in, erpc::Codec * out, uint32_t sequence); my files(erpc_matrix_multiply_server.h): erpc_status_t erpcMatrixMultiply_shim(erpc::Codec * codec, uint32_t sequence); why files are different , Am i missing any config ? Do i need to manually edit erpc_matrix_multiply_server.h & erpc_matrix_multiply_server.cpp Thank you in advance Chandini
View full article
S32K3 Motor control SW examples The S32K3 family of 32-bit AEC-Q100 qualified MCUs combines a scalable family of Arm® Cortex-M7-based microcontrollers built on long-lasting features with a comprehensive suite of production-grade tools. S32K3 MCUs are included in NXP’s Product Longevity Program, guaranteeing a minimum of 15 years of assured supply. The S32K3 offers dedicated peripherals set for rapid motor control loop implementation: enhanced Modular IO Subsystem(eMIOS), Logic Control Unit (LCU), TRGMUX, BodyCross-triggering Unit (BCTU), Analog to Digital Converter(ADC), and Analog Comparator (CMP). The comprehensive motor control ecosystem based on Automotive Math and Motor Control Library(AMMCLib) set, FreeMASTER with Motor Control ApplicationTuning (MCAT) tool and Model-Based Design Toolbox (MBDT) helps to enable S32K3 MCU in wide range of motor control use cases. The table below points to the articles with more detailed description each of S32K3 motor control use cases, hardware description, links to appropriate application notes and their addendums, and software repositories.  Device HW Article S32K344 MCSPTE1AK344 12 V development kit engineered for 3-phase PMSM and BLDC motor control applications FOC with dual shunt current measurement Article focuses on solution based Field Oriented Control (FOC) technique (typically used for 3-phase PMSM motors) with dual shunt current measurement and without any position sensor (sensorless). The Encoder sensor is supported by SW option, but missing on HW kit. The available example codes covers both ANSI-C and Matlab Simulink approaches and uses RTD drivers with high-level Autosar compliant API or low-level non-Autosar API.    FOC with single shunt current measurement Article focuses on solution based Field Oriented Control (FOC) technique (typically used for 3-phase PMSM motors) with single shunt current measurement and without any position sensor (sensorless). The Encoder sensor is supported by SW option, but missing on HW kit. The single shunt current measurement is advanced technique that allows decrese the cost of Bill of Material (BOM). The available example codes covers both ANSI-C and Matlab Simulink approaches and uses RTD drivers with high-level Autosar compliant API or low-level non-Autosar API.    FOC integrated with FreeRTOS Article focuses on integration of motor control software (based on FOC with dual shunt current measurement) and Real Time Operating System (FreeRTOS). The available example code is based ANSI-C  code and uses RTD drivers with low-level non-Autosar API.    Six-step commutation control. Article focuses on solution based Six-step commutation (6-step) technique (typically used for 3-phase BLDC motors) with Hall position sensor and without any position sensor (sensorless). The available example codes covers both ANSI-C and Matlab Simulink approaches and uses RTD drivers with low-level non-Autosar API.    Note: the list of use cases cannot cover all combinations of MCU, current measurement scenario, control technique and sensor inputs, but should work as a base reference for most common configurations. This list is not final, please follow this acticle to be notified about updates with new use cases.   
View full article
示例 S32K118-SRAM-keep_data_over_SW_reset v0_1 S32DS.ARM.2.2 ******************************************************************************** * Detailed Description: * The purpose of this example is show how to keep data in SRAM memory over SW * reset. SW reset is triggered by pressing the SW3 button on the S32K118EVB. * Reset is delayed for 514 LPO cycles. In the RCM interrupt, SRAMU_RETEN is * cleared allowing to retain SRAM data during the reset. After SW reset, * SRAMU_RETEN is set to allow accesses to SRAM. * File startup_S32K116.S in modified to skip ECC RAM initialization for SW reset * source. To check whether stored data stayed unmodified in the SRAM, specified * address is read and the LED lights up. * ------------------------------------------------------------------------------ * Test HW: S32K118EVB-Q064 * MCU: S32K118 LAMLH 0N97V QTZE1802B * Fsys: fsys = 48MHz * Debugger: Lauterbach Trace32 * Target: Debug * Terminal: 19200-8-no parity-1 stop bit-no flow control * EVB connection: default ******************************************************************************** Revision History: Ver Date Author Description of Changes 0.0 May-17-2023 David Tosenovjan Initial version *******************************************************************************/
View full article
S32 Design Studio for ARM Version 2.2 许可证到期,麻烦帮忙延期,谢谢! S32 Design Studio for ARM Version 2.2 许可证到期,麻烦帮忙延期,谢谢! Re: S32 Design Studio for ARM Version 2.2 许可证到期,麻烦帮忙延期,谢谢! 你好, 您的S32DS许可证已延期。
View full article
USB 输出事务缺少 ACK 我的团队在 USB 输出事务中遇到了 ACK 缺失的问题。 关于我们系统的一些信息: * MCU 型号为 LPC5528 * SDK 版本为 26.03.00。 * 对于 USB_DeviceInit 的调用,我们将 kUSB_ControllerLpcIp3511Fs0 作为第一个参数(controllerId)提供,以便我们使用 USB 全速。 很难对模式做出太多评价。我们可以肯定的是: * 当我们通过 USB 发送大量消息时,偶尔会出现 OUT 事务缺少 ACK 的情况。我们用Ellisys USB分析仪检测到了这个问题。我们可以看到缺少 OUT 信号,然后 PC 进行了 3 次重试,最后通过 USB RESET。 这种情况很少发生。我们编写了一个脚本,重复发送相同的简单 USB 消息(目标只是返回一些数据,没有繁重的计算等)。有时只需几次迭代,有时则需要数千次迭代才会出现错误。 我们想知道这是否是一个已知问题,或者是否有调试技巧。 Re: Missing ACK on USB OUT Transactions 嗨@JacobBerggreen 我们已经检查了 LPC55S2x/LPC552x 的勘误表,没有发现任何与 USB0 全速设备输出直接对应的缺少 ACK 相关的已知问题。目前,USB勘误表主要集中在高速模式上,因此并不直接适用于您的配置。 从这种现象来看,更可能的原因是 OUT 端点在某些时刻没有及时准备接收缓冲区,导致主机发送 OUT 时设备无法响应 ACK,从而触发信号重试甚至 RESET。建议重点确认每次 OUT 完成后是否立即调用 USB_ServiceRecvRequest(),并尽量减少回调中的处理。还建议检查 USB 中断的优先级,避免长时间的关机中断。 BR 哈里
View full article
How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 NXPサポートチームの皆様、こんにちは。  現在、S32K314、RTD 7.0.0、およびFreeRTOSを使用したプロジェクトに取り組んでいます。MCALのADCモジュールを使用して、MCUに接続された外部デバイスの電圧、MCUの内部温度(TEMPSENSE)、MCUの内部電圧(ANAMUX)、およびバンドギャップ電圧の測定を実装しようとしています。測定結果を見ると、外部デバイスの電圧とバンドギャップ電圧は正しく測定されているようですが、MCUの内部温度と内部電圧の値は予想と異なっています。 期待値: MCU内部電圧(VDD_HV_A): 8192(2.5V、14ビット分解能) 実測値: 約6800~7100(2.07~2.13V、14ビット分解能) MCUの電源電圧は5.0Vです。ADCハードウェアユニットはADC0に設定され、ADC測定対象は以下のように構成されます。  Ch8:MCU内部温度(TEMPSENSE)  Ch9:MCU内部電圧(ANAMUX)  第10章:バンドギャップ ADC Setting00.png ADC Setting01.png ADC Setting02.png  MCU入力電圧 = 5.0V ADC Setting03.png ADC Setting04.png ADC初期化コード: void AdcAdapter_Init ( void ) { Adc_Calibrate ( ADC0 , & calStatus ) ; Adc_SetupResultBuffer ( ADC0 , Group0Result ) ; IP_DCM_GPR -> DCMRWF1 = ( IP_DCM_GPR -> DCMRWF1 | DCM_GPR_DCMRWF1_SUPPLY_MON_EN ( 1 ) | DCM_GPR_DCMRWF1_VDD_HV_A_VLT_DVDR_EN ( 1 ) | DCM_GPR_DCMRWF1_VDD_HV_B_VLT_DVDR_EN ( 1 ) | DCM_GPR_DCMRWF1_VDD_1_5_VLT_DVDR_EN ( 1 ) ) ; IP_DCM_GPR -> DCMRWF1 = ( IP_DCM_GPR -> DCMRWF1 & ~ DCM_GPR_DCMRWF1_SUPPLY_MON_SEL_MASK ) | DCM_GPR_DCMRWF1_SUPPLY_MON_SEL ( 0U ) ; // VDD_HV_A_DIV Adc_StartGroupConversion ( ADC0 ) ; // AdcConversionStart } ADCデータ取得(すべての周期的なタスク) void AdcAdapter_RunCyclic ( void ) { Adc_StatusType ret = ADC_IDLE ; Std_ReturnType adcStatus ; uint16 temperature ; // 変換完了チェック ret = Adc_GetGroupStatus ( ADC0 ) ; if ( ( ret == ADC_COMPLETED ) || ( ret == ADC_STREAM_COMPLETED ) ) { // 結果を取得 Adc_ReadGroup ( ADC0 , Group0Result ) ; // 次の変換を開始 Adc_StartGroupConversion ( ADC0 ) ; } else { // エラーログ } /* Adc_TempSenseGetTemp Singed Q11.4 */ adcStatus = Adc_TempSenseGetTemp ( ADC0 , mcuTemperature ) ; if ( E_OK == adcStatus ) { temperature = Adc_TempSenseCalculateTemp ( ADC0 , mcuTemperature ) ; } else { // エラーログ } }  ADC0グループのADC値は`Adc_ReadGroup`を使用して更新できると思いますが、MCUの内部温度については`Adc_TempSenseGetTemp`と`Adc_TempSenseCalculateTemp`を使用する必要があると思います。もし私が見落としている設定があれば教えてください。 Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは、センレントさん。 迅速なご対応ありがとうございます。 ご提供いただいたサンプルコードは既に確認済みで、私のコードに組み込んだと考えています。 ご提供いただいた表は、ADCブロックに供給される各クロックに対するレジスタ設定の表であると解釈しました。しかし、それらがMCALのどのADC設定に対応しているのかを特定することはできませんでした。 ソースコードを提供できないため、ADC設定の画像を添付します。どの設定を変更すればよいか教えてください。 他に何か必要な設定画面があれば、お知らせください。 1_ADC_ConfigTimeSupport.png AdcHwUnit> 2_ADC Config_AdcHwUnit.png 3_ADC General.png 4_ADC0 HwConfiguration.png 6_ADC AutosarExt.png Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは@輝彦 提供された情報にはADCの完全な構成が見当たらなかったので、ADCクロックがデータシートの要件に合っているか再確認してください。 可能であれば、テストプロジェクトを共有していただければ、私が確認します。 Senlent_0-1782458295032.png ちなみに、下記のリンクからデモをご覧ください。 https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-TempSenser-S32DS36-RTD600-500-400-p24/ta-p/2136187 Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは、センレントさん。 アドバイスありがとうございます。 ご助言に従い、TEMPSENSEのサンプリング時間を1.2マイクロ秒に設定するように、以下のように設定を変更しました。 ADC Setting10.png 160MHz = 0.00625マイクロ秒 1.2マイクロ秒/0.00625マイクロ秒= 192 ADC Setting11.png FreeRTOSで1秒サイクルのタスクを作成し、MCU電圧(VDD_HV_A)とMCU温度(TEMPSENSE)のADC値を毎秒取得しました(30秒分のデータ収集)。 ADC Setting13.png MCU電圧についてはバンドギャップ電圧を使い、以下の補償式でmVに変換しました。 (バンドギャップ電圧はほとんど変動せず、約3975(約1.2V)の値が得られた。) Adc補正 = (1200(mV) * Adc_VCC_HV_A) / Adc_バンドギャップ Mcu電圧 = アドコレーション × 2(2は電圧分割比VDD_HV_A) ADC Setting12.png さらに、 McuTempデータは `Adc_TempSenseGetTemp(ADC0, &mcuTemperature)` から取得されます。 ADC変換誤差が±5.0%であることを考慮しても、このばらつきは大きすぎると思います。何か解決策の提案はありますか?   Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは@輝彦 ご提供いただいた設定画面のスクリーンショットとコードを見る限り、明らかなエラーは見当たりません。ただし、温度センサのサンプリング時間は1.2μsを超えなければならないことに注意が必要です。そうでなければ、サンプリングの精度に影響します。したがって、テストを行う前にサンプリング時間を再度確認することをお勧めします。 Senlent_0-1782377529947.png Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 ADC_Config>AdcHwUnitの画像が圧縮されて解像度が低下したため、再アップロードします。 <#1> 2_ADC Config_AdcHwUnit_1.png <#2> 2_ADC Config_AdcHwUnit_2.png <#3> 2_ADC Config_AdcHwUnit_3.png Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは@輝彦 温度チャネルから生データを直接読み取って、変動があるかどうかを観察できます。変動が大きい場合は、サンプリング時間を延ばし続けるCAN。 Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは、センレントさん。 ご返信ありがとうございます。 下図に示すように、サンプリング期間1/期間2の値を増加させた後、値は安定しました。デフォルト設定はサンプリング持続時間0だと思っていましたが、サンプリング持続時間0、1、2の切り替えはどうすればいいのでしょうか? 10_ADCConfig_AdcHwUnit.png (プリスケール設定に基づくと、ADCクロックは80MHzなので、1.2μsに相当する期間は96となる。) Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは、センレントさん。 ドキュメントを添付してくださりありがとうございます。現在チャネル32から63を測定しているので、これはサンプリング持続時間1に対応していると理解しています。 迅速なご対応ありがとうございます。問題は解決しました。 Re: How to Measure the Internal Temperature and Voltage of an MCU Using the ADC0 こんにちは、センレントさん。 私は表317の情報を以下のように解釈しました。 fmc = 160 MHz の場合: ・キャリブレーション用のプリスケーラを4に設定する ・通常のADC変換のプリスケーラを2に設定する ・「ADC高速」を無効に設定する 7_ADCConfig_AdcHwUnit.png これらの設定を適用して得られたデータは、以下の表に示されています。 平均化することでばらつきは減りましたが、MCU内部温度の変動は依然としてかなり大きいと感じます。 8_ADCConfig_AdcHwUnit.png 以下の表は、ADC値から°Cに変換したMCU温度データを示しています。 (ADC値を摂氏に変換するために、ADC値を16で割りました。) 9_ADCConfig_AdcHwUnit.png 16点平均で2.55度の変動は極めて大きい。MCUの温度はプロセッシング負荷によって変動することは理解していますが、これほど瞬時に大きく変わるのは普通のことですか? MCUの内部温度を測定する際に、平均を取るのが正しいアプローチでしょうか?
View full article
i.MX 95 SPSDK によるセキュアブート (日本語ブログ) はじめに i.MX 95 でのセキュアブートに使用する署名付きのコンテナ・イメージを Secure Provisioning SDK (SPSDK) で作成し、起動する手順です。 i.MX 95 では、セキュアブートのデジタル署名アルゴリズムとして、クラシックなRSA暗号や楕円曲線デジタル署名暗号 (ECDSA)に加えて、耐量子暗号 (PQC)の ML-DSA もサポートされています。 ここでは、ECDSA と PQC ML-DSA 両方の署名認証を行うHybrid boot での実現例を見ていきます。 セキュアブート・プロセス(概念図) 署名付きイメージの作成 Prepare.png SRKH : Super Root Key Hash i.MX 95 AHAB (Advanced High Accuracy Boot) セキュアブート・フロー Boot-Auth.png 本記事は、i.MX 95 向けのLinux BSP を一度ビルド済みの前提で紹介します。 ビルド方法については以下の記事をご参照ください。 ビルドするターゲットを、i.MX 95 のマシン名とする必要がありますが、同様の方法になります。  [入門] Yocto Linux BSPのビルド方法 - i.MX FRDMボード編 (日本語ブログ) [入門] Yocto Linux BSPのビルド方法 - i.MX 8M Plus編 今回動作確認に使用した環境 ハードウェア:開発ボード i.MX 95 19x19 LPDDR5 EVK ソフトウェア:Linux BSP Version L6.18.2-1.0.0 ツール:SPSDK version 3.9.0, Linux 版 eMMC/SDブートであれば、FRDM i.MX 95開発ボード(FRDM-IMX95 / LPDDR4X対応)でも同様の手順で実施することができます。 目次 1. Linux BSP での準備 2. SPSDK のインストール 3. 鍵の作成 4. YAMLファイルの準備 5. ワークスペースの準備 6. 署名付きイメージの作成  7. 署名付きイメージの導入 8. SRKH (Super Root Key Hash) eFuse のプログラム 9. ライフサイクルを OEM Closed に更新 10. ELE イベントの確認 11. ブートローダの直接署名   eMMC/SDブートとFlexSPI NORブートでは、準備手順や実行するコマンドが一部異なります。そのため、確認したいブートデバイスに応じた手順を実施してください。 1. Linux BSP での準備 1.1 ブートローダ FlexSPI NOR ブート BSP デフォルトでのブートローダは、eMMC/SD ブート用となっています。 FlexSPI NOR ブートの場合には、 / /conf/local.conf ファイルに下記を追記しておきます。 UBOOT_CONFIG = "fspi" eMMC / SD / FlexSPI NOR ブート共通 u-boot の  CONFIG_AHAB_BOOT  を有効にしてビルドしたブートローダを使用します。 $ cd $ source setup-environment $ bitbake u-boot-imx -c cleansstate $ bitbake u-boot-imx -c configure $ bitbake u-boot-imx -c devshell 別のシェルが開きますので、u-boot コンフィグレーションを変更します。 # make O=../../build/ / menuconfig O= で指定するビルド・ディレクトリのパスは、実際の環境に合わせます。 atsushihonda_0-1780816914768.png ../../build/ /.config で、 CONFIG_AHAB_BOOT=y  となっていることを確認し、元のシェルに戻ります。 # exit 元のシェルで、再ビルドを行います。 $ bitbake u-boot-imx -c compile -f $ bitbake imx-boot 1.2 Linux カーネルとデバイスツリー BSP でビルドされたバイナリをそのまま利用します。 ビルドされたバイナリは、BSP の  /tmp/deploy/images/ / に作成されています。 2. SPSDK のインストール SPSDK Installation Guide に従い、Python 仮想環境 venv を準備してインストールします。 インストール後、バージョン情報やヘルプ表示ができるかを確認します。 (venv) $ spsdk --version (venv) $ spsdk --help PQCプラグインも追加します。 (venv) $ pip install spsdk-pqc 3. 鍵の作成 ECDSA SECP384 の秘密鍵/公開鍵を、4ペア作成します。 (venv) $ mkdir -p keys/secp384r1 (venv) $ nxpcrypto -v key generate -k secp384r1 -o keys/secp384r1/srk0_secp384r1.pem (venv) $ nxpcrypto -v key generate -k secp384r1 -o keys/secp384r1/srk1_secp384r1.pem (venv) $ nxpcrypto -v key generate -k secp384r1 -o keys/secp384r1/srk2_secp384r1.pem (venv) $ nxpcrypto -v key generate -k secp384r1 -o keys/secp384r1/srk3_secp384r1.pem PQC ML-DSA の秘密鍵/公開鍵も、4ペア作成します。 (venv) $ mkdir keys/mldsa65 (venv) $ nxpcrypto -v key generate -k mldsa65 -o keys/mldsa65/srk0_mldsa65.pem (venv) $ nxpcrypto -v key generate -k mldsa65 -o keys/mldsa65/srk1_mldsa65.pem (venv) $ nxpcrypto -v key generate -k mldsa65 -o keys/mldsa65/srk2_mldsa65.pem (venv) $ nxpcrypto -v key generate -k mldsa65 -o keys/mldsa65/srk3_mldsa65.pem i.MX 95 内蔵eFuse に公開鍵のハッシュ Super Root Key Hash (SRKH) を書いたあと、イメージをビルドしなおした時は、その公開鍵とペアとなる秘密鍵で署名する必要があるので、作成したすべての鍵は保存しておきます。 秘密鍵は、第三者に開示しないようにします。 4. YAMLファイルの準備 SPSDK では、YAMLファイルに、コンテナヘッダ設定や、秘密鍵、公開鍵および、署名付きイメージを構成するバイナリファイルのパスを指定します。 あわせて、今回の動作確認で使用したYAMLファイルの例もご参照ください。 YAMLファイルでのコンテナヘッダ設定や、鍵を指定する項目は、次のようになっています。 コンテナヘッダ container-header.jpg YAMLキー 内容 srk_set SRK Set used_srk_id SRK Selection srk_revoke_mask SRK Revoke Mask gdet_runtime_behavior GDET enablement check_all_signatures Check all signatures fastboot Fast Boot fuse_version Fuse Version sw_version SW Version コンテナヘッダの各フィールドは、i.MX 95 Reference Manual の、『Container header details』に記載されています。 鍵の指定 YAMLキー 内容 signer クラシック 秘密鍵 signer_#2 PQC 秘密鍵 srk_table クラシック 公開鍵テーブル srk_table_#2 PQC 公開鍵テーブル すべてのYAMLファイルで同じ鍵を指定します。 4.1 ブートローダ用YAML ファイル YAMLファイルのテンプレートを作成し、spl.yaml と uboot.yaml を準備します。 (venv) $ nxpimage ahab get-template -f mimx9596 -o ahab_template.yaml (venv) $ cp ahab_template.yaml spl.yaml (venv) $ cp ahab_template.yaml uboot.yaml spl.yaml i.MX 95 内蔵SRAM にロードされ、DRAM 初期化トレーニングなどを実施する部分までのファイルを指定します。 YAML キー 内容 binary_container ELE ブート・ファームウエア(マスク・レビジョン専用のバイナリ) lpddr_imem LPDDR4X or 5 初期化ファームウエア lpddr_imem_qb LPDDR4X or 5 初期化ファームウエア lpddr_dmem LPDDR4X or 5 初期化データ lpddr_dmem_qb LPDDR4X or 5 初期化データ oei_ddr OEI system_manager System Manager spl U-boot SPL cortex_m7_app (Option) M7 image image_path (Option) FCB copy image uboot.yaml U-boot SPL でDRAMにロードされる部分のファイルを指定します。 YAML キー 内容 atf ARM Trusted Firmware uboot U-boot tee (Option) OP-TEE OS (Option) 4.2 FCB の取り出し - FlexSPI NOR ブートのみ FlexSPI NOR ブート用のYAMLファイルでは、FCB (FlexSPI Configuration Block)も指定します。そのため、FlexSPI NOR ブート向けにビルドした通常の署名なしブートローダ (flash.bin) から、SPSDK コマンドにて、FCB を取り出しておきます。 i.MX 95 内蔵eFuse のFlexSPI_NOR_FCB_Offset (デフォルト 0x400) にFCB が配置されています。そのオフセットから 512 バイト分を取り出し、 fcb.bin を作成します。 (venv) $ nxpimage utils binary-image extract -b flash.bin -a 0x400 -s 0x200 -o fcb.bin 4.3 OSコンテナ用YAML ファイル YAMLファイルのテンプレートから、os_cntr.yaml を準備します。 (venv) $ cp ahab_template.yaml os_cntr.yaml os_cntr.yaml では、キー image_path で、Linux カーネルと使用するデバイスツリーのパスをセットし、その他必要なパラメータも設定します。 4.4 デジタル署名アルゴリズムの選択 i.MX 95 内蔵eFuse やコンテナヘッダのFlags で選択することになります。 eFuse atsushihonda_0-1780649240945.png コンテナヘッダの Flags フィールド atsushihonda_1-1780649320607.png コンテナヘッダの Flags フィールドにある "Bit 15: Check all signature" = 0x1 とすることで、eFuse のELE_BOOT_CRYPTO 設定によらず、コンテナ内にあるすべての署名を認証します。 コンテナヘッダの Flags フィールドの "Check all signature"は、YAML キー "check_all_signature" で指定します。 atsushihonda_2-1780649548095.png 5. ワークスペースの準備 SPSDK でワークスペースを作成し、必要な鍵ファイル、YAML ファイル およびバイナリファイルを配置します。 5.1 ワークスペースの作成 (venv) $ nxpimage bootable-image get-templates -f mimx9596 -o workspace 5.2 鍵ファイル 鍵の作成で作ったkeys フォルダごと持ってきます。 5.3 YAML ファイル例 動作確認に使用したYAMLファイルを、imx95-spsdk-yaml-examples.tar.gz に添付しています。 atsushihonda_0-1781411327200.png 5.4 バイナリファイル Yocto Linux BSP からバイナリファイルを持ってくる場合、 ブートローダを構成するバイナリ $ bitbake -e imx-boot | grep ^S= により表示されるパスの、 iMX95/ にあるバイナリからコピーします。 Linux カーネル / /tmp/deploy/images/ /Image-- - - .bin を コピーします。 デバイスツリー / /tmp/deploy/images/ /にあるdtb で、使用するもの1つコピーします。 YAMLファイルの例 を使用する場合、 ・Linux カーネルは、Image ・デバイスツリーは、imx95.dtb という名前で、それぞれ配置します。 5.5 eMMC / SD ブート 下記のようなファイル構成となります。 YAMLファイルの例を使用する場合、spl.yaml は、DRAMタイプにより、emmc_sd/spl-lpddr4x.yaml または spl-lpddr5.yaml から名前を変更して配置します。 workspace.jpg 上記では、ELE ブート・ファームウエア は、RevC 品 (B0マスク)用の mx95b0-ahab-container.img となっています。 5.6 FlexSPI NOR ブート 下記のようなファイル構成となります。fcb.binも必要です。 YAMLファイルの例を使用する場合、fspi_nor/から、bootable_image_fspi_nor.yaml をコピーしてきます。 また、spl_fspi_nor-lpddr5.yaml を spl.yaml に名前を変更し配置します。 workspace-fspi.jpg 上記では、ELE ブート・ファームウエア は、RevC 品 (B0マスク)用の mx95b0-ahab-container.img となっています。 6. 署名付きイメージの作成 署名付きブートローダと署名付き OS コンテナのイメージを、 SPSDK で作成します。 ワークスペースの準備 で作成されたディレクトリに移動して作業します。 (venv) $ cd workspace/imx_boot_flash_all/imx95-19x19-lpddr5-evk/ 6.1 署名付きブートローダ 鍵ファイルとバイナリファイルを指定する spl.yaml と uboot.yaml を、bootable_image.yaml から呼び出します。 署名付きブートローダ signed_flash.bin と、SRKH eFuse プログラム用のスクリプト (*.bcf) が作成されます。 bootloader-export.jpg eMMC / SD ブート (venv) $ nxpimage -v bootable-image export --config bootable_image.yaml -o output/signed_flash.bin 下記のような情報が、表示されます。 container.jpg FlexSPI NOR ブート (venv) $ nxpimage -v bootable-image export --config bootable_image_fspi_nor.yaml -o output/signed_flash.bin 下記のような情報が、表示されます。 eMMC/SDとの違いとして、FCB が先頭についているのが分かります。 container-fspi.png イメージの検証を行うことができます。 // eMMC / SD ブート (venv) $ nxpimage -v bootable-image verify -f mimx9596 -b output/signed_flash.bin -m serial_downloader // FlexSPI NOR ブート (venv) $ nxpimage -v bootable-image verify -f mimx9596 -b output/signed_flash.bin -m flexspi_nor 6.2 署名付きOSコンテナ os_cntr.yaml の内容で、署名付き OS コンテナのイメージを作成します。 os-export.jpg (venv) $ nxpimage -v ahab export -c os_cntr.yaml 下記のような情報が、表示されます。 os-container.jpg イメージの検証を行うことができます。 (venv) $ nxpimage -v bootable-image verify -f mimx9596 -b output/os_cntr_signed.bin -m serial_downloader 7. 署名付きイメージの導入 作成した署名付きブートローダおよび署名付きOSコンテナを導入する方法です。 7.1 署名付きブートローダ i.MX95 ボードのブートデバイスに、signed_flash.bin を書き込みます。 ボードのデバッグ・ポートとシリアル・ダウンロード・ポートを、PC に接続します。 u-boot が起動する場合には fastboot モードにします。 u-boot=> fastboot 0 もしくは、BOOT_MODE を シリアル・ダウンロード・モード として起動しておきます。 SPSDKで書き込みます。 // eMMC (venv) $ nxpuuu write -b emmc -f mimx9596 output/signed_flash.bin // SD (venv) $ nxpuuu write -b sd -f mimx9596 output/signed_flash.bin // FlexSPI NOR (venv) $ nxpuuu write -b qspi -f mimx9596 output/signed_flash.bin SPSDK の nxpuuu コマンドではなく、通常の uuu または u-boot コマンドを使用して書き込むことも可能です。 7.2 署名付きOSコンテナ あらかじめBSP イメージが書き込んであるeMMC もしくはSDカード の boot パーティションに、os_cntr_signed.bin を入れます。 u-boot コマンドで、i.MX95 の接続されたeMMC または SDカードを、USBストレージとしてみせることで、PCにマウントさせます。 シリアル・ダウンロード・ポートをPC に接続しておく必要があります。 // eMMC u-boot=> ums mmc 0 // SDカード u-boot=> ums mmc 1 PC にマウントされた boot パーティションに 、os_cntr_signed.bin をコピーしたあと、u-boot で Ctrl-C を押します。 もしくは、別の手段で os_cntr_signed.bin を、boot パーティションに入れておきます。 署名付きOSコンテナの起動時、下記のような表示が出ます。 atsushihonda_0-1780816312885.png CONFIG_AHAB_BOOT  を有効にした u-boot では、通常のLinux Image (署名なし)ではなく、 os_cntr_signed.bin (署名付き)が使用されます。 7.3 動作確認 この段階では、i.MX95 のライフサイクルの状態は、OEM Open のため、u-boot や Linux が起動しますが、KEY HASH の検証失敗が、ELE イベントで検出されます。 8. SRKH (Super Root Key Hash) eFuse のプログラム 8.1 eFuse 書き込み i.MX 95 SRKH eFuse に、公開鍵のハッシュ値を書き込みます。 一度書き込むと元に戻せません。 書き込んだデバイスで、署名付きブートローダや署名付きOS コンテナを更新するときは、書き込んだ SRKH のもととなる公開鍵のペアである秘密鍵を使い署名します。 別の鍵ペアを使う場合には、現在のSRKH をRevoke し、4組作成しておいた鍵ペアで未使用のものを使用します。 i.MX 95 ボードのシリアル・ダウンロード・ポートをPCに接続し、 u-boot はあらかじめ fastboot モードにしておきます。 u-boot=> fastboot 0 署名付きイメージの作成で作られたSRKH eFuse のプログラミング用スクリプト(*.bcf) を使い、 SPSDK で書き込みます。 SRKH eFuse のプログラミング用スクリプトには、 i.MX 95 eFuse の word index が記載されています。 // OEM_SRKH (venv) $ nxpele -f mimx9596 batch output/ahab_oem0_srk0_hash_nxpele.bcf // OEM_PQC_SRKH (venv) $ nxpele -f mimx9596 batch output/ahab_oem0_srk1_hash_nxpele.bcf 8.2 eFuse 値の確認 SPSDK の nxpele コマンドで、 eFuse のword index を指定しリードして、値を確認することができます。 // OEM_SRKH[31:0] word index = 128 (venv) $ nxpele -f mimx9596 read-common-fuse -i 128 // OEM_PQC_SRKH[511:480] word index = 463 (venv) nxpele -f mimx9596 read-common-fuse -i 463 など SPSDK の代わりに、U-boot コマンド もしくは System Manager モニタのコマンドで、eFuse にリード・ライトアクセスすることもできます。 U-boot u-boot=> fuse read u-boot=> fuse prog System-Manager >$ fuse.r >$ fuse.w 8.3 動作確認 この段階では、i.MX 95 のライフサイクルの状態は、OEM Openですが、SRKH プログラム済みのため、改ざんがなければ、ELEイベントは検出されません。 改ざんがあっても、その部分が動作に影響しなければ、OEM Openのため起動しますが、認証の失敗が ELE イベントで検出されます。 9. ライフサイクルを OEM Closed に更新 i.MX 95 出荷直後のライフサイクルは、OEM Open です。 デバッグ終了後に、i.MX 95 のライフサイクルを OEM Closed に変更します。 OEM Closed にしたあとの留意点 OEM Openには戻せません。 CONFIG_AHAB_BOOT=y とした u-boot を含んだブートローダで起動すると、署名の無いイメージや、不正な署名付きイメージは起動できなくなります。 CONFIG_AHAB_BOOT=y としていない u-boot を含んだブートローダでは、署名なし Linux Image で起動できてしまいますので、必ず署名付きOS コンテナ os_cntr_signed.bin で起動させるため、 CONFIG_AHAB_BOOT=y とした u-boot を含んだブートローダを使用します。 動作確認後、署名なしのLinux Image やデバイスツリーは、boot パーティションから削除します。 9.1 SPSDK i.MX 95 ボードのシリアル・ダウンロード・ポートはPCと接続し、u-boot は、あらかじめfastboot モードにしておきます。 u-boot=> fastboot 0 SPSDK でライフサイクルを更新します。 (venv) $ nxpele -f mimx9596 forward-lifecycle-update -l OEM_CLOSED Forward Lifecycle update ends successfully. (venv) $ 9.2 U-boot u-boot=> ahab_close OEM Closed とした後、 uuu で BSP イメージ (wic ファイル) を書き込む場合にも、署名付きブートローダを使用する必要があります。 10. ELE イベントの確認 ELE (Edgelock Secure Enclave) は、i.MX 95 の内蔵ブロックで、セキュアブート時のコンテナ・イメージの認証を行います。 SPSDK および U-boot、System Manager コマンドで、ELE の状態を確認することができます。 10.1 SPSDK シリアル・ダウンロード・ポートとPCを接続し、U-boot でfastboot モードにしてから行います。 u-boot=> fastboot 0 SPSDK でELE イベントを取得します。 (venv) $ nxpele -f mimx9596 get-events 10.2 U-boot CONFIG_AHAB_BOOT=y  としたU-boot で使用できるコマンドです。 デバイスのライフサイクルにより、OEM Open または OEM closed も表示されます。 u-boot=> ahab_status 10.3 System Manager >$ ele events 10.4 表示例 ELE イベント(SRKH 値の不一致)が検出されたとき SPSDK atsushihonda_1-1780905351035.png U-boot (OEM open時) atsushihonda_0-1780905260272.png System Manager atsushihonda_2-1780905394816.png ELE イベント検出がないとき SPSDK atsushihonda_0-1780814351679.png U-boot (OEM close後) atsushihonda_1-1780814397838.png System Manager atsushihonda_2-1780814531326.png   11. ブートローダの直接署名 既存の署名なしブートローダのバイナリに、 SPSDK で直接署名を追加することも可能です。 この場合、SPSDK がブートローダ・バイナリのコンテナから構成を解釈します。 YAML ファイルで、各イメージごとの細かい設定は指定できませんが、コンテナヘッダの設定と秘密鍵および公開鍵のパスを指定するのみで、署名付きブートローダを作成することができます。 11.1 テンプレートの作成 (venv) $ nxpimage ahab get-template -f mimx9596 -o ahab_sign.yaml --sign (venv) $ cp ahab_sign.yaml sign.yaml 11.2 YAML ファイル sign.yaml に、コンテナヘッダの設定と秘密鍵および公開鍵のパスを指定します。 YAMLファイルの例 を使用する場合、 direct_signing/sign.yaml をコピーしておきます。 11.3 署名の追加 既存のブートローダのバイナリ flash.bin に署名処理を行います。 // eMMC / SD (venv) $ nxpimage ahab sign -c sign.yaml -b flash.bin -o output/flash_directsign.bin -fs output // FlexSPI NOR (venv) $ nxpimage ahab sign -c sign.yaml -b flash.bin -o output/flash_directsign.bin -fs output -m flexspi_nor output/flash_directsign.bin と、SRKH eFuse のプログラミング用スクリプト output/*.bcf が作成されます。 おわりに SoC 起動イメージの保護を実現するため、i.MX 95 セキュアブートに使用する署名付きイメージを、SPSDK を使って作成し、起動するまでの流れを紹介しました。今回はi.MX 95 AHAB で新たに追加されたPQCを利用する手順例で示しました。 ========================= 本投稿の「Comment」欄にコメントをいただいても、現在返信に対応しておりません。 お手数をおかけしますが、お問い合わせの際には「NXPへの技術質問 - 問い合わせ方法 (日本語ブログ)」をご参照ください。 (既に弊社NXP代理店、もしくはNXPとお付き合いのある方は、直接担当者へご質問いただいてもかまいません。) i.MX95 でのセキュアブートに使用する署名付きのコンテナ・イメージを Secure Provisioning SDK (SPSDK) で作成し、起動する手順をハンズオン形式で学べる内容となっています。 楕円曲線デジタル署名暗号 (ECDSA)と、耐量子暗号 (PQC) ML-DSA 両方の署名認証を行うHybrid boot での実現例を紹介します。 (作業時間:半日 *一度i.MX 95向けの Linux BSP のビルドが完了している前提) i.MX Processors Security 日本語ブログ
View full article
i.MX6 HABv4 ブート失敗: 生産ボードでのUSBロード成功後、`j4 err` **客観的:** 私たちの目標は、`imx_usb`ローダーを使用して、eMMCを介さずにボードを直接RAMから起動することです。これは、故障解析における重要なステップです。USBブートパスのみを確実にテストするため、製造基板上のeMMCを物理的に切断しました。 **ボードステート:** 1. **開発ボード:** ヒューズは切れていません。SoCは**開発モード**にあると報告しています。 2. **製造基板:** セキュアブートのためにヒューズが切れます。SoCは**生産モード**にあると報告しています。 **結果の概要:** `imx_usb`ユーティリティを使用した際に、2つの異なる結果が観測されています。 **1.成功:開発ボード** 開発ボード上では、署名されていない `u-boot.imx`問題なくロードされ、実行されます。ログにはバイナリがロードされ、SoCがエントリポイントにジャンプしたことが記録されている。 * **コマンド:** `sudo ./imx_usbu-boot.imx` * **キーログ出力(`development.txt`):** 「`」 HABセキュリティ状態:開発モード(0x56787856) ... バイナリファイル(u-boot.imx)を読み込んでいます877ff400、スキップ=0、fsize=5faa4、タイプ=aa 成功しました(ステータス 0x88888888) 0x877ff400にジャンプします 「`」 (結果:ボードがU-Bootプロンプトで起動します) **2.失敗: 生産ボード** 弊社製品版ボードでは、**署名付き`u-boot.imx`**を使用しています。当社の製造チームによって提供され、SoCに組み込まれているハッシュと同じ鍵で署名されています。`imx_usb`ツールは、DCDとバイナリが正常にロードされたことを報告します。しかし、最後のジャンプコマンドは失敗します。 * **コマンド:** `sudo ./imx_usbu-boot-signed.imx` * **キーログ出力(`production.txt`):** 「`」 HABセキュリティ状態:プロダクションモード(0x12343412) ... バイナリファイル(u-boot.imx)を読み込んでいます877ff400へ、スキップ=0、fsize=5faa4、タイプ=aa 成功しました(ステータス 0x88888888) 0x877ff400にジャンプします j4 in err=0、last_trans=64 33 18 c0 00 「`」 *(結果: ボードが起動しません。コンソール出力なし。)* **分析と重要な質問:** 決定的な違いは、「0x877ff400へジャンプする」コマンドの結果です。製造基板上では、イメージがRAMに正常に転送された直後のまさにこの段階で処理が失敗する。これは、SoCのブートROMがRAM内のイメージを実行する前に**HABv4署名検証**を実行しており、この検証が失敗していることを強く示唆しています。 `j4 err`は標準的なUSBエラーではありません。これは、`imx_usb`ツールがjumpコマンドに関連して返す内部ステータスコードのようです。根本的な問題は、ジャンプが成功しないことだ。 1. **HAB認証失敗:** `j4 err`(またはそれに続く起動の失敗)は、HAB認証の失敗を示していますか?ブートROMはイメージを正常に受け入れたものの、実行を拒否しているようだ。 2. **USBブート用イメージ署名:** USBシリアルダウンロードプロトコル経由でロードすることを目的としたU-Bootイメージに署名するための特定の要件またはフォーマットはありますか?私たちはeMMCブート用に署名されたイメージを使用しています。`0x877ff400`に画像がロードされた際に、HABが画像を拒否する原因として、想定されるIVT(画像ベクトルテーブル)構造やその他のメタデータに違いがある可能性はありますか? 3. **ロードアドレス:** イメージは `0x877ff400` にロードされています。これは、セキュリティ保護されたi.MX6上のUSBメモリに保存されたイメージの正しいアドレスですか?ブートROMは、認証のためにイメージがRAM内の別の場所に配置されていることを想定しているのでしょうか? Re: i.MX6 HABv4 Boot Failure: `j4 err` After Successful USB Load on Production Board こんにちは、 署名済みのイメージはeMMCブート用に作成されていますか? エラーは、ステップのRAMへのロードは成功したが、ROMによって実行が拒否されたことを示しています。 HAB認証失敗。 Re: i.MX6 HABv4 Boot Failure: `j4 err` After Successful USB Load on Production Board imx_usb_loader(シリアルダウンロードプロトコル)を使い、RAMから完全にU-BootとLinuxを起動しました。そのライブU-Bootセッションから、以下のイメージをeMMCに書き込みました。 # U-Boot IVT は必須の 1 KiB ハードウェアオフセットで動作します mmc dev 1 0 mmc 書き込み 0x82000000 0x2 0x400 # アクティブパーティションを超えた生セクターへのFITイメージ mmc 書き込み 0x80800000 0x66000 0x3000 # ブート環境 setenv bootargs "console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw" setenv loadfit "mmc dev 1 0; mmc read 0x80800000 0x66000 0x3000" setenv bootcmd "run loadfit; bootz 0x808000e8 - 0x80da4bc0" saveenv このU-Bootプロンプトから手動で実行するrunブートは正しく動作します — Linuxは問題なく/dev/mmcblk1p2を起動・マウントします。作業ログをメールに添付しました。 故障状態: 電源投入時やハードウェアリセット時に、USB OTGケーブルが物理的に切断されている場合、ボードはUART出力をゼロにし、静かにUSBシリアルダウンロードモードに再移行します。ROMはeMMCに到達していないようだ。 Re: i.MX6 HABv4 Boot Failure: `j4 err` After Successful USB Load on Production Board こんにちは、 はい、イメージはeMMCブート用に署名されています。RAM上では問題なく動作しますが、eMMCへの書き込みができません。 Re: i.MX6 HABv4 Boot Failure: `j4 err` After Successful USB Load on Production Board 皆さんこんにちは、このチケットの状況はどうなっていますか?また、今後どう進めればよいでしょうか?対面(現地)での会議は必要ですか?
View full article