SDIO probe function isn't been called after moving SDIO device driver library to an old Linux platform using platform device and no device tree - linux-device-driver

I currently porting a sdio device driver (which's working on linux 4.3 or higher) to an old linux platform 3.10.14. The new one uses device tree to manage sdio bus and the driver uses some sdio api like sdio_register_driver, int sdio_probe(struct sdio_func*, struct sdio_device_id*), but the old one uses platform device with api platform_device_register used in the kernel. I installed the module to system have the old kernel and the probe function isn't called, please help me to fix this. I'm a newbie, I hope you guys can understand what I describe.
Thanks,
I tried replace field drv.of_match_table in struct sdio_driver (because of no device tree in old kernel) to drv.name (because platform device detects base on name field) but the probe function still isn't called

Related

Run a Windows/Mac/Linux command from Flutter and read stdout

I am working on a new product, and I have developed a flutter application using Flutter Blue Plus for connectivity to a custom piece of hardware I designed. FBP currently only supports iOS and Android. Even though it is 2023, integrated BLE for Desktops is still a bit underdeveloped and I don't want to write platform specific BLE code yet. The solution is to use a USB Dongle that I have used in the past, which has the full stack and all the hardware to work on any OS with USB access (BLED112 by Silicon Labs). The customers will be required to buy the dongle for $15 until BLE support for desktops mature. I did this before and it was fine.
My question is how do I run an executable from Flutter, and read all of the standard output, without blocking?
I plan on using a simple Python script that interfaces to the dongle with the serial port and spits out GAP and GATT data in real time. I want to launch the Python script from Flutter when Linux/Windows/macOS is detected.
I want to make sure I am going down the correct path with this idea.
Use process_run package.
final shell = Shell();
await shell.run('''
# Display dart version
dart --version
# Display pub version
flutter doctor
''');

How to create patch to modify the device driver?

I need to modify the busb.c to from the bluetooth device drivers to work with the bluetooth USB dongle with the Yocto dunfell.
I know, how to create the patch and include with the yocto image for the Device Tree Source file (DTS)
But, with the Linux kernel module, I'm facing the error while baking the image.
Can any one redirect me to customize the kernel module via patch under Yocto?

STm32L4R5VG firmware upgrade in run time

In my application, I am using STm32L4R5VG as a host MCU. I want to upgrade the firmware of host MCU in run time over USB through the Android mobile app.
I have looked into USB DFU mode, but in that case, my device will enumerate as ST USB and also I need to enable the boot loader with boot pin.
In actuality, my device will connect with the Android mobile app using the CDC class device and enumerates as VCP. So I want to send the firmware file from Android mobile to host MCU over VCP and write into Bank2 of internal flash (as current code is in Bank1). Once the file transfer is done, the device will reboot on its own and check for the latest firmware and boots from Bank2.
I am stuck at how to write at bank2 securely during run time and perform self reset to boot from Bank2.
If anyone already worked on this or know about this then please guide me or point to the link where I can get details for this.

"No ST-LINK detected" error message, when trying to connect with ST-LINK Utility

I have a
NUCLEO-F401RE board
(with STM32F401RE)
and it has been working fine for the most part. Here recently, I followed a tutorial in the book
"Mastering STM32"
where it says to install
OpenOCD.
I had been following along before this as well, and I had been able to connect to my board and flashing it with no problem.
After attempting to get OpenOCD to work though, this is no longer possible. Every time I try to connect to my board, I simply get the following error message:
No ST-LINK detected
I have tried updating the drivers multiple times, rebooting the board, reinstalling the ST-LINK Utility, switching the USB-Cable, resetting the board and reinstalling everything and I have also tried the trick where you hold down the reset button and try to erase the chip.
So far, none of this has worked for me unfortunately.
Here you find a picture of my board.
On my desktop, I am using Windows 10. On my board, and I am using FreeRTOS.
Here you find an image of my Windows Device Manager.
I have also tried to update the firmware on my board using the ST-Link upgrade, but without luck. When attempting this, I either do not have the option to select my device (when using the .jar app) or when using the .exe app, I just get the following error messages:
No ST-Link device detected
Please connect it and then retry
I have not been able to find a solution for this anywhere, so I hope you guys can help! If you need any further relevant information, just let me know. Thank you very much.
As mentioned in other answers, the problem is almost certainly due to a competing driver (something like libusb) taking control of the device.
However, you do not need to "uninstall and reinstall everything" to select the correct driver, assuming that you have already installed it once before. Moreover, the reinstallation procedure most likely won't help, because the uninstallers usually do not uninstall the drivers anyway, and Windows will keep prefering the same wrong driver.
Instead, open Device Manager, find your STM32 STLink device, double-click to open the Properties dialog. Then click "Update Driver", then "Browse my computer for driver software", then "Let me pick from a list of available drivers on my computer", and you should see something like that:
You see that in this example, at least four different drivers available on the system are happy to service the device. The first two are generic libusb drivers, not specific to the dongle (OpenOCD is happy to use either of those, if I remember correctly). The ST-Link utility, however, wants a dedicated driver, developed by STM - those are the two entries below on my picture. If you do not see those, try installing the ST-Link utility again (no need to uninstall anything) or download just the driver from the STM website.
You can now click on the preferred driver in this list and have it replace whatever driver was assigned to the device before.
From my poor experience the "No ST-LINK detected" message in the STM32 Utility shows when you are disconnected or when other program is using a ST-LINK. So, if this start happens after installing OpenOCD try to uninstall this and try again (maybe with option "Connect under reset"?).
For your information. When you plug the cable to the PC and the board is power on then in the settings (STM32 Utility) you can see available ST-Links (even blocked). Here is example when ST-Link is blocked
From what I have learned and understood (but everyone can correct me :)), your board is divided in two parts :
The ST-Link debugger part ;
The rest with the actual microcontroller.
The ST-Link part is used to flash the microcontroller and can be used to flash any other STM32F4 device through SWD. With your picture :
The STM32 ST-Link Utility uses the ST-Link part of your board to flash it. My point is that if you have the "No ST-Link detected", the issue, I am quite sure, doesn't come from the microcontroller part but comes from the ST-Link part. And since you did say that it worked before you install openocd, I would suggest the driver part in W10 that may be the root of your problems.
Try to uninstall everything (and I mean everything) related to the STM32 (openocd, STM32 ST-Link Utility and its driver through Device Manager).
Reinstall only STM32 ST-Link utility (if you did uninstall the drivers correctly, it should ask you the permission to install the drivers during set up) and try to connect your board.
You can also try to remove the SWD jumpers (connector CN2) on your board to detach the ST-Link from the built-in microcontroller part. Since the ST-Link part is independent it will still be detected by the STM32 ST-Link Utility (but you will have to put the jumpers back if you want to actually program your microcontroller).
Just ran into this. The problem boiled down to using nucleo boards and trying to interface with them using older versions of ST-LINK (ST's search for ST-Link's first hit led me to stsw-link0004, which was not installing the right drivers). Why they don't point you to the latest greatest first, who knows.
Whenever I tried to install drivers, I could only select USB Composite device as a compatible driver, despite repeatedly uninstalling/reinstalling stlink0004.
You need to install the newest st-link e.g. stsw-link0009 (or newer).
Uninstall device (device manager had it under USB Composite Device)
Uninstall ST-LINK
Disconnect nucleo.
Reboot.
Install ST-link (stsw-link0009)
The prompt should have you install 3+ drivers. Not just 2.
Plug in. Voila.

Filed to run Contiki applications in QEMU

I was trying to play with several tiny operating systems in an emulator but got stuck with Contiki in QEMU. Ideally the compiled executable should be run as a kernel in QEMU. For all OS's I was playing with I used this simple command to run executables in QEMU:
qemu-system-platform -nographic -kernel compiled_executable
In the case of Contiki, QEMU freezes regardless of any target platform the executables are compiled for, even for target platform "native", which according to the documentation, is built with "x86 gcc".
I also tried ARM-based platforms with the same freezing issues. If I specify a correct CPU model (e.g. cortex-m3 for cc2538dk), I received a segmentation fault instead.
I am wondering if I was missing any steps to cause the QEMU to freeze. Does it mean that the compiled executable cannot be treated as kernels (yet), unless I provide some QEMU-specific codes to initialize QEMU as a "board" for Contiki?
The native platform is used to build a "natively" (i.e. on Linux or other OS) executable image of Contiki - an userland app, rather than an OS kernel.