I compiled stm32flash under FreeBSD 8.4-STABLE:
I just unpacked the source code and compiled it, no patches:
The resulting binary appears to work:
I have an STM32 board connected to cuaU0/ttyU0:
and my user has access:
Still it doesn't work:
It doesn't work as root either, so it doesn't look like a permissions problem.
BTW, stm32flash with the same board and cable works nicely under Linux. Any hints on what could be wrong?
Code:
tingo@kg-core1$ uname -a
FreeBSD kg-core1.kg4.no 8.4-STABLE FreeBSD 8.4-STABLE #0 r253646: Thu Jul 25 10:12:31 UTC 2013
root@kg-core1.kg4.no:/usr/obj/usr/src/sys/GENERIC amd64
Code:
tingo@kg-core1$ pwd
/home/tingo/work/stm32flash
tingo@kg-core1$ gmake
gmake -C parsers
gmake[1]: Entering directory `/zs/tingo/work/stm32flash/parsers'
gcc -g -Wall -c -I../ binary.c hex.c
ar r parsers.a binary.o hex.o
ar: warning: creating parsers.a
gmake[1]: Leaving directory `/zs/tingo/work/stm32flash/parsers'
gcc -g -o stm32flash -I./ \
main.c \
utils.c \
stm32.c \
serial_common.c \
serial_platform.c \
parsers/parsers.a \
stm32/stmreset_binary.c \
-Wall
In file included from main.c:31:
serial.h:82: warning: type qualifiers ignored on function return type
serial.h:83: warning: type qualifiers ignored on function return type
serial.h:84: warning: type qualifiers ignored on function return type
serial.h:85: warning: type qualifiers ignored on function return type
In file included from stm32.h:25,
from stm32.c:24:
serial.h:82: warning: type qualifiers ignored on function return type
serial.h:83: warning: type qualifiers ignored on function return type
serial.h:84: warning: type qualifiers ignored on function return type
serial.h:85: warning: type qualifiers ignored on function return type
In file included from serial_common.c:20:
serial.h:82: warning: type qualifiers ignored on function return type
serial.h:83: warning: type qualifiers ignored on function return type
serial.h:84: warning: type qualifiers ignored on function return type
serial.h:85: warning: type qualifiers ignored on function return type
serial_common.c:39: warning: type qualifiers ignored on function return type
serial_common.c:57: warning: type qualifiers ignored on function return type
serial_common.c:69: warning: type qualifiers ignored on function return type
serial_common.c:80: warning: type qualifiers ignored on function return type
In file included from serial_posix.c:28,
from serial_platform.c:4:
serial.h:82: warning: type qualifiers ignored on function return type
serial.h:83: warning: type qualifiers ignored on function return type
serial.h:84: warning: type qualifiers ignored on function return type
serial.h:85: warning: type qualifiers ignored on function return type
Code:
tingo@kg-core1$ ./stm32flash
stm32flash - http://stm32flash.googlecode.com/
ERROR: Device not specified
Usage: ./stm32flash [-bvngfhc] [-[rw] filename] /dev/ttyS0
-b rate Baud rate (default 57600)
-r filename Read flash to file
-w filename Write flash to file
-u Disable the flash write-protection
-e n Only erase n pages before writing the flash
-v Verify writes
-n count Retry failed writes up to count times (default 10)
-g address Start execution at specified address (0 = flash start)
-f Force binary parser
-h Show this help
-c Resume the connection (don't send initial INIT)
*Baud rate must be kept the same as the first init*
This is useful if the reset fails
Examples:
Get device information:
./stm32flash /dev/ttyS0
Write with verify and then start execution:
./stm32flash -w filename -v -g 0x0 /dev/ttyS0
Read flash to file:
./stm32flash -r filename /dev/ttyS0
Start execution:
./stm32flash -g 0x0 /dev/ttyS0
Code:
tingo@kg-core1$ ls -l /dev/cuaU* /dev/ttyU*
crw-rw---- 1 uucp operator 0, 159 Aug 18 17:26 /dev/cuaU0
crw-rw---- 1 uucp operator 0, 160 Aug 18 17:26 /dev/cuaU0.init
crw-rw---- 1 uucp operator 0, 161 Aug 18 17:26 /dev/cuaU0.lock
crw-rw---- 1 root operator 0, 156 Aug 18 17:26 /dev/ttyU0
crw-rw---- 1 root operator 0, 157 Aug 18 17:26 /dev/ttyU0.init
crw-rw---- 1 root operator 0, 158 Aug 18 17:26 /dev/ttyU0.lock
Code:
tingo@kg-core1$ id
uid=1001(tingo) gid=1001(users) groups=1001(users),0(wheel),5(operator)
Code:
tingo@kg-core1$ ./stm32flash /dev/cuaU0
stm32flash - http://stm32flash.googlecode.com/
/dev/cuaU0: No such file or directory
tingo@kg-core1$ ./stm32flash /dev/ttyU0
stm32flash - http://stm32flash.googlecode.com/
/dev/ttyU0: No such file or directory
BTW, stm32flash with the same board and cable works nicely under Linux. Any hints on what could be wrong?