I use the openocd script below to dump the flash memory of a STM32 microcontroller.
mkdir -p dump
openocd -f board/stm3241g_eval_stlink.cfg \
\
-c "init" \
-c "reset halt" \
-c "dump_image dump/image.bin 0x08000000 0x100000" \
-c "shutdown" \
FILENAME=dump/image.bin
FILESIZE=$(stat -c%s "$FILENAME")
echo "Size of $FILENAME = $FILESIZE bytes."
The script is supposed to read the whole memory which is 1MB in my case but it does it very rarely. Generally it stops reading the memory before the end.
Why can't I obtain 1MB each time I execute this script? What is the problem here to cause openocd stop dumping the rest of the memory?
You can use dfu-utils to reflash your STM32 micros.
In Ubuntu/Debian distros you can install dfu-utils with apt:
$ sudo apt-get install dfu-util
$ sudo apt-get install fwupd
Boot your board in DFU mode (check datasheet). Once in DFU mode, you should see something similar to this:
$ lsusb | grep DFU
Bus 003 Device 076: ID 0483:df11 STMicroelectronics STM Device in DFU Mode
Once booted in DFU mode, reflash your binary:
$ sudo dfu-util -d 0483:df11 -a 0 -s 0x08000000:leave -D build/$(PROJECT).bin
With -d option you choose product:vendorid such as listed by lsusb in DFU mode.
With the -a 0 option you select alternate mode 0, check the options available as in the following example:
$ sudo dfu-util -l
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=1, name="#Option Bytes /0x1FFFF800/01*016 e", serial="FFFFFFFEFFFF"
Found DFU: [0483:df11] ver=2200, devnum=101, cfg=1, intf=0, alt=0, name="#Internal Flash /0x08000000/064*0002Kg", serial="FFFFFFFEFFFF"
As you can see, alt=0 is for internal flash memory.
With the -s option you specify the flash memory address where you save your binary. Check your memory map in datasheet.
Hope this helps! :-)
Related
I've followed the excellent guide here to upgrade from 9.6.2 to 10.5 on mac os 10.11.6. When I get to the step 6
pg_upgrade -b /usr/local/Cellar/postgresql/9.6.2/bin/ \
-B /usr/local/Cellar/postgresql/10.5/bin/ \
-d /usr/local/Cellar/postgres.old/ \
-D /usr/local/Cellar/postgres.new/
I get this error
check for "/usr/local/Cellar/postgresql/9.6.2/bin" failed: No such file or directory
even though mv /usr/local/Cellar/postgresql/9.6.2 /usr/local/Cellar/postgres.old ran ok.
However when I go to
/usr/local/Cellar/postgresql/9.6.2/bin/: No such file or directory
Looking at
$ du -sh /usr/local/var/*/
148K /usr/local/var/homebrew/
917M /usr/local/var/log/
202G /usr/local/var/postgres96/
37M /usr/local/var/postgresql#9.6/
I think my data is still there (postgres96) but don't understand how to get to it and finish pg_upgrade. Any help gratefully appreciated
EDIT;
I think i need to run something like the below to undo the error i made;
undo the move
mv /usr/local/Cellar/postgres.old /usr/local/Cellar/postgresql/9.6.2
Check that worked running
ls /usr/local/Cellar/post*
I should see a bin in the 9.6.2 direcotry and then i can initialize a new cluster data dir:
initdb /usr/local/var/postgres.new
then
pg_upgrade -b /usr/local/Cellar/postgresql/9.6.2/bin/ \
-B /usr/local/Cellar/postgresql/10.5/bin/ \
-d /usr/local/var/postgres96/ \
-D /usr/local/var/postgres.new/
Is that correct?
Given I've backed up with pg_dump
I am trying to create an image (.iso) of my installed CentOS 5.11 system, for this i am using the "Mondo Rescue" with the command:
mondoarchive -Oi -9 -L -d /tmp/centos_iso -I / -T /tmp/centos_iso -p centos_image -s 4480m -E "/tmp|/var/spool/squid|/var/log"
The image is generated, and apparently is functional.
To install the iso in other machine i'm using the option "Nuke", in initialization page of "Mondo Rescue", like is represented in below image
When attempting to perform the installation, the following error occurs during the process:
Kernel panic - not syncing: No init found. Try passing init= options to kernel.
I'm very new to Raspberry Pi, and have no prior notable experience with Linux so this is all new to me...
Octoprint is a 3D printer spooler that you can run on your raspberry pi. One of the features on Octoprint is the ability to setup a USB camera to view either still images or a stream of your print.
I am using the Octopi prepackaged Octoprint image.
Octoprint's github contains the following info referring to my USB camera. But I have no idea how to implement this.
Hama PC-Webcam "AC-150" on Raspberry Pi
./mjpg_streamer -o output_http.so -w ./www -i input_uvc.so -y -r 640x480 -f 10
https://github.com/foosel/OctoPrint/wiki/Webcams-known-to-work
I'm guessing this is an easy command that I enter via console, but I've winged few commands with no luck. Can someone shed some light on how I use this? Like I said I'm an absolute beginner with the pi...
Any help is greatly appreciated!
Try this:
camera_usb_options="-r VGA -f 10 -y"
sudo service octoprint stop
fuser /dev/video0
/dev/video0: **1871m**
$ ps axl | grep **1871** *Change this number by yours*
$ kill -9 **1871**
./mjpg_streamer -i "input_uvc.so $camera_usb_options" -o "output_http.so -w ./www"
sudo service octoprint start
As I am implementing digital signage with Dell Monitor.
First thing as I already google there is no option to stop or uninstall screenly & get back to raspberry pi desktop.
I want to know, how we can do that?
pi#raspberrypi ~ $ /opt/vc/bin/tvservice -s
state 0x120016 [DVI DMT (4) RGB full 4:3], 640x480 # 60Hz, progressive
My monitor maximum resolution is 1920x1200 with 16:10 aspect ratio, why tvservice giving me above mentioned output?
thanks in advanced,
Bhushan Vaiude
Here is ans:
ps aux | grep creen
less ~/screenly/misc/gtkrc-2.0
less ~/.config/openbox/lxde-rc.xml.bak
less ~/.config/openbox/lxde-rc.xml
less ~/.config/lxpanel/LXDE/panels/panel.bak
less /etc/xdg/lxsession/LXDE/autostart.bak
ulink /etc/supervisor/conf.d/screenly.conf
unlink /etc/supervisor/conf.d/screenly.conf
sudo unlink /etc/supervisor/conf.d/screenly.conf
sudo unlink ~/.gtkrc-2.0
ls -l ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/
unlink ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/
ls -l ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/mv ~/.config/openbox/lxde-rc.xml.bak ~/.config/openbox/lxde-rc.xml
mv ~/.config/openbox/lxde-rc.xml.bak ~/.config/openbox/lxde-rc.xml
ls -l ~/.config/openbox/lxde-rc.xml
ls ~/.config/lxpanel/LXDE/panels/panel
ls ~/.config/lxpanel/LXDE/panels/pane*
mv ~/.config/lxpanel/LXDE/panels/panel.bak ~/.config/lxpanel/LXDE/panels/panel
sudo ls -l /etc/xdg/lxsession/LXDE/autostart
sudo ls -l /etc/xdg/lxsession/LXDE/autostart*
sudo mv /etc/xdg/lxsession/LXDE/autostart.bak /etc/xdg/lxsession/LXDE/autostart
less /etc/lightdm/lightdm.conf
sudo nano /etc/lightdm/lightdm.conf
#comment xserver-command
sudo shutdown -r now
thanks!
Whereas I did get my earlier problem with building proper boot images fixed, I've been struggling with another GRUB2-related problem for most of the day.
The problem is that even though I do set the video info request bit in my multiboot header, GRUB2 does not return proper VESA BIOS Extensions (VBE) info.
The kernel is my own work, and it's noteworthy that it Used to Work (TM) with some earlier version of GRUB2 (I could fill the screen with white pixels, no problem).
Here's my current grub.cfg:
set timeout=10
set default=0
menuentry "zero" {
set gfxmode=1024x768x24
set gfxpayload=keep
insmod vbe
insmod gfxterm
multiboot /kern
}
And here's the script I use to build my boot images:
echo Building kernel
./build.sh
echo Creating bootable CD image...
cp zero cdimg2/kern
grub-mkimage --format=i386-pc --output=core.img \
--config="cdimg2/boot/grub/grub.cfg" loadenv biosdisk \
part_msdos part_gpt fat ntfs \
ext2 ntfscomp iso9660 loopback search linux boot \
minicmd cat cpuid chain \
halt help ls reboot echo test configfile normal sleep \
memdisk tar font \
gfxterm gettext true vbe vga video_bochs video_cirrus \
multiboot multiboot2
cat /usr/lib/grub/i386-pc/cdboot.img core.img > \
cdimg2/grub.img
genisoimage -A "ZERO" -input-charset "iso8859-1" -R -b \
grub.img -no-emul-boot \
-boot-load-size 4 -boot-info-table -o cd.iso cdimg2