: error: 'PM_MCUBOOT_SECONDARY_ID' undeclared (first use in this function) 65 | #define PM__mcuboot_secondary_ID PM_MCUBOOT_SECONDARY_ID
Could you please assist me in creating a DTM project, that is updatable via dfu mode?
Thank you very much,
: error: 'PM_MCUBOOT_SECONDARY_ID' undeclared (first use in this function) 65 | #define PM__mcuboot_secondary_ID PM_MCUBOOT_SECONDARY_ID
Hi Edvin,
thank you for looking in to this.
The nrf5340 will be part of another product and enable new features for our users.
We want to have various apps that the user can cycle through on our products: the user will select an "app" and it will be pushed to the nrf5340 in the background via USB dfe from a linux host.
The DTM mode will be one such application, which will only be available for a select view users (mainly internal testing, production chain, certification labs, etc.).
We have this workflow working for other applications, but the DTM applications does not yet work.
We use the Ublox Nora B - I've included the boards directory for this board.
I've also included the modified sample code.
Please do not hesitate to contact me, if you have any further questions.
If you send me a DM I can also give you my company contact informations.
dtm_and_dfe_together.tar.gz
Just to be clear, it is the direct_test_mode, and not the sample_code_remote_shell we are trying to build?
What is your build command? "west build -b ubc_evknorab10_nrf5340/nrf5340/cpuapp" ? or some additional build flags?
Best regards,
Edvin
And what NCS version?
Yes, exactly, the direct_test_mode is the project we are trying to build.
If I copy the sample_code in to the nrf/samples/nrf5340/remote_shell directory, I actually get the DTM application to show up in dfu - alas only the Ramdisk.
This is my west build command, as generated by VS Code nrf connect plugin:
west build --build-dir /home/user/workspace/nrf-bluetooth/direct_test_mode/build /home/user/workspace/nrf-bluetooth/direct_test_mode --pristine --board ubx_evknorab10/nrf5340/cpunet --sysbuild -- -DBOARD_ROOT="/home/user/workspace/nrf-bluetooth"
Yes, exactly, the direct_test_mode is the project we are trying to build.
If I copy the sample_code in to the nrf/samples/nrf5340/remote_shell directory, I actually get the DTM application to show up in dfu - alas only the Ramdisk.
This is my west build command, as generated by VS Code nrf connect plugin:
west build --build-dir /home/user/workspace/nrf-bluetooth/direct_test_mode/build /home/user/workspace/nrf-bluetooth/direct_test_mode --pristine --board ubx_evknorab10/nrf5340/cpunet --sysbuild -- -DBOARD_ROOT="/home/user/workspace/nrf-bluetooth"
I see this:
Parsing C:/nordic/SDKs/ncs/v3.1.1/nrf/samples/nrf5340/direct_test_mode/Kconfig.sysbuild C:/nordic/SDKs/ncs/v3.1.1/zephyr/scripts/kconfig/kconfig.py: C:/nordic/SDKs/ncs/v3.1.1/nrf/samples/nrf5340/direct_test_mode/Kconfig.sysbuild:67: 'C:/nordic/SDKs/ncs/v3.1.1/nrf/samples/nrf5340/direct_test_mode\../common/usb/Kconfig.sample_usbd' not found (in 'rsource "../common/usb/Kconfig.sample_usbd"')
Outside the application folder, what "common" folder is it trying to point to? Where exactly do I need to place the direct_test_mode folder?
You said you place it in the nrf\samples\nrf5340\remote_shell directory, but this does not have a "common" folder in it's parent folder.
Best regards,
Edvin
Ah, sorry - I missed the "common" directory.
It is however just some effort on my side to try to get all files that the project needs out of the SDK folder and in to the repository.
This came together, because I had problem described in this ticket and I tried to "copy" all files in to the repo, that the original direct_test_mode project needs.
Please find attached the an archive with this common directory included.
I am very sorry to have missed this the first round...dtm_and_dfe_together_v2.tar.gz
No worries. I didn't get the time to look into these today, but I will try next week.
Best regards,
Edvin
Ok, just tried building the sample now, using NVS v3.1.1 (and toolchain 3.1.1), and it built without any errors.
I used the command:
west build -b ubx_evknorab10/nrf5340/cpunet -d build -- -DBOARD_ROOT="../."
Can you try to update the toolchain to v3.1.1 as well?
Best regards,
Edvin
Hi Edvin,
Thank you again for looking in to this .
YES, the project - as is - builds successfully.
This was however not the issue or the question I was trying to ask:
the problem is how to get DTM and DFU working together.
I am unclear how we can modify the DTM code to add USB-DFU functionality to it.
Also, how we can get west to use local sources, e.g. while building I get a warning:
57/242] Building C object CMakeFiles/app.dir/src/main.c.obj
/home/user/ncs/v3.1.1/nrf/samples/nrf5340/remote_shell/src/main.c: In function 'main':
/home/user/ncs/v3.1.1/nrf/samples/nrf5340/remote_shell/src/main.c:138:15: warning: implicit declaration of function 'dfu_init' [-Wimplicit-function-declaration]
138 | err = dfu_init();
| ^~~~~~~~
Here you see that nrf connect uses "main.c" from the "samples" directory, I would however like that this code would exist locally in our git repository and that west does use source code from other folders.
---
After flashing the project it shows up in the "dfu-util" utility:
user:~/workspace/nrf-bluetooth/direct_test_mode(user.dfu_and_dtm)$ sudo dfu-util -l dfu-util 0.11 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2021 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Found Runtime: [2fe3:0001] ver=0401, devnum=35, cfg=1, intf=2, path="3-7.4.5", alt=0, name="UNKNOWN", serial="8924B12F028AA082"
However, the chip can not successfully be flashed:
user:~/workspace/nrf-bluetooth/direct_test_mode(user.dfu_and_dtm)$ sudo dfu-util --alt 0 --download build/direct_test_mode/zephyr/zephyr.signed.bin dfu-util 0.11 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2021 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ dfu-util: Warning: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release Opening DFU capable USB device... Device ID 2fe3:0001 Run-Time device DFU version 0110 Claiming USB DFU (Run-Time) Interface... Setting Alternate Interface zero... Determining device status... DFU state(0) = appIDLE, status(0) = No error condition is present Device really in Run-Time Mode, send DFU detach request... Device will detach and reattach... Opening DFU USB Device... Claiming USB DFU Interface... Setting Alternate Interface #0 ... Determining device status... DFU state(2) = dfuIDLE, status(0) = No error condition is present DFU mode device DFU version 0110 Device returned transfer size 512 Copying data from PC to DFU device Download [ ] 0% 0 bytesdfu-util: Error during download (LIBUSB_ERROR_PIPE)
It seems that the dfu functionality is not "present" once the device is detached.
Could you please assist us in getting DTM working together with DFU mode?