How DAPLink make its virtual file system? - embedded

I am new to DAPLink. Just know that it could turn a cortex m0 chip into a mbed Interface, then we could program or debug thought it. But I found that the mbed Interface has about 8MB USB Disk. How does it work? As we known, a mbed Interface chip(such as 11u24) has only 8KB RAM and 64KB Flash.

It does not actually have 8MB of space on the disk, the virtual file system just tells the operating system that it is 8MB large. This variable is held in vfs_user.c.
Then the virtual file system hijacks writes to the device and instead routes them to the target MCU through the Debug Access Port. So there is no caching on the chip that runs DAPLink, nor is there flash required. The files that show up when you mount the drive - like mbed.htm - are baked into ROM.

Related

Make USB appear as a CD

Right. So I've been looking at VBS Scripts and batch files recently and autorun.inf would really be the cherry on the cake (don't worry I don't plan on using it as a tool for evil). I know that it has been turned off by default on Windows 7 onward but I read somewhere that it is still on for CDs. So naturally, I wonder - Is it possible to make the USB drive look as if it were a CD to make autorun work?
a USB pen drive and a USB CD tray have the same device class (USB mass storage device class). the problem is that despite the same device class there are other parts in USB protocol that differ (interface descriptors, configuration descriptors, endpoint descriptors,...) These usb descriptors that are also responsible for what driver / kernel module is loaded by the os, are hardcoded in the firmware of the device. your only chance to make a pen drive appear as a CD is to change these hardcoded descriptors or what is easier, to build your own device using a microcontroller with USB functionality in that you program your custom descriptors. Note that kernel modules and drivers are based on standardized protocol so your descriptors have fit these standards for the device to work.
In http://www.beyondlogic.org/usbnutshell/usb1.shtml is more information about USB protocol and the descriptors...

how to Remote firmware update of stm32 microcontroller with a code backup

we are planning to use stm32f4 discovery board in our satellite.we will have a code backup in the sd card.How to dump the code on to the Microcontroller when there is a code corruption.
You need to write a bootloader that has access to the SD card peripheral which will read the backup code off of the card and program the flash program space on the STM32 itself (assuming this is where you are running the code from).
There are plenty of resources on bootloading the STM32. Here are just a few
STM32 microcontroller system memory boot mode
Make own bootloader for Arm Cortex-M3
You need boot loader to do your work. You may choose to use the example boot loader that STM provided or your can write your own boot loader.
The flash you reserve for the bootloader must be a whole number of flash pages starting from the reset address , After that you will have to rebuild your application code for the new start address because current start address has bene taken by Bootloader.

virtual memory on windows

I am developing a program which use huge ram size. Unfortunately there is no way to decrease it. In linux when ram is low I can generate a swap file and mount it to system that solve my problem but in windows how can I do that or is there any api(c/c++) that can use a temp file like a ram?

How can I program ST MCUs from USB disk without PC?

I want to program (such as STM32F407 cortex M4 MCU) without PC, by using only MCU board, USB disk and USB cable. Binary(.HEX) file should be stored in USB disk. then bootloader which preloaded in MCU, should load binary file from usb to the program memory.
Is it possible to do it, as I describe above?
Yes it is entirely possible given a suitable boot loader. I have implemented a boot loader on STM32 that accepts updates over serial, SD card or USB VCP; adding USB mass storage support would be a relatively simple extension.
Your boot loader will require USB mass storage device support, for which the USB controller must support operation as a USB host, and you will require a file system (could be read-only to reduce size). You will also need to support flash programming.

usb target disk mode equivalent on running system

Is there anyway that you can expose local partition or disk image through your computer usb to another computer to appear like external drive on mac/linux/bsd system ?
I'm trying to play with something like kernel development and I need one system for compiling and other for restarting/testing.
With USB: Not a chance. USB is unidirectional, and your development system has no way of emulating a mass storage device, or any kind of other USB device.
With Firewire: Theoretically. (This is what Apple's target disk mode is using.) However, I can't find a readily available solution for that.
I'd advice you to try either virtualization or network boot. VirtualBox is free and open software, and has a variety of command line options, which means it can be scripted. Network boot takes a little effort to set up, but can work really well.
Yet another option, is to use a minimal Linux distribution as a bootstrap which sets up the environment you want, and then uses kexec to launch your kernel, possibly with GRUB as an intermediary step.
What kind of kernel are you fiddling with? If it's your own code, will the kernel operate in real or protected mode? Do you strictly need disk access, or do you just want to boot the actual kernel?