RUL SDK on Linux
This is about the OS build. The SDK's manual has very basic instructions, this article aims to fill the gaps. As of version 1.2.0, there's also a mistake in the project cmake files, which causes the OSAL to be completely omitted from the build.
Preparing the HW
On the PTX205R solder the jumpers for:
MCU OFF
PMOD_VDD TO VDD_IO
Connect the PTX board to the Raspberry:
PTX205R PMOD | Raspberry Pi 5 |
|---|---|
MOSI | GPIO 10 |
MISO | GPIO 9 |
SCK | GPIO 11 |
NSS | GPIO 7 |
IRQ | GPIO 19 |
SEN | GPIO 21 |
Don't forget to connect the PTX board via USB-C for power.
Building and Running an Example Project
Let's take the project NFC Forum Basic Discovery as the example for this article. There's a mistake in the cmake files, so let's fix it first.
Open
CMakeLists.txtinside the project's root directory:PROJECTS/PTX2xxR/NFC_FORUM_BASIC_DISCOVERYFind
add_definitions("-DPTX_APP_DIVERSITY_LIN")and replace-DPTX_APP_DIVERSITY_LINwith-DPTX_APP_DIVERSITY_LINUX. This define is necessary, in order for the OSAL to be initialized and used across the source code.Generate the RF-config C files with the Config Tool, and replace
ptx_NSC_RfConfigVal.candptx_NSC_RfConfigVal.hunderSRC/COMPS/NSC/RUL.Create the build directory, called BUILD for instance:
PROJECTS/PTX2xxR/NFC_FORUM_BASIC_DISCOVERY/BUILDConfigure
cmakefor Linux, SPI and the Console for printing log messages and File for internal logging (log file will be created inside the BUILD directory). Run this from the BUILD directory:cmake .. -DPTX_BUILD_LIN=ON -DPTX_ENABLE_SPI=ON -DPTX_UTILITY_PRINTING=Console -DPTX_LOGGING=File
Build the example application:
cmake --build .
Run the app:
./NFC_FORUM_BASIC_DISCOVERY- Running the app in the console
Debugging
The following launch.json configurations can be used for debugging in VS Code. When debugging is started, VS Code will ask for the project name. This should be the exact name of the example project's root directory, for example NFC_FORUM_BASIC_DISCOVERY under PROJECTS/PTX2xxR/ .
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"inputs": [
{
"id": "projectName",
"description": "exact name of example project's root directory, for example NFC_FORUM_BASIC_DISCOVERY under PROJECTS/PTX2xxR/",
"type": "promptString",
"default": "NFC_FORUM_BASIC_DISCOVERY"
}
],
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/PROJECTS/PTX2xxR/${input:projectName}/BUILD/${input:projectName}",
"MIMode": "gdb",
"cwd": "${workspaceFolder}/PROJECTS/PTX2xxR/${input:projectName}/BUILD/",
"stopAtEntry": false,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
} |