From owner-freebsd-arm@FreeBSD.ORG Wed Sep 18 17:03:10 2013 Return-Path: Delivered-To: freebsd-arm@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AA6D1B00 for ; Wed, 18 Sep 2013 17:03:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F250279B for ; Wed, 18 Sep 2013 17:03:10 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VMHza-000Jk2-1j; Wed, 18 Sep 2013 13:40:30 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r8IDeQeF014965; Wed, 18 Sep 2013 07:40:26 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18kw3rLz/tvTkl0TGMEem11 Subject: Re: stm32flash under FreeBSD? From: Ian Lepore To: Torfinn Ingolfsen In-Reply-To: <20130918101235.e1737d4bd839f71ebf554803@getmail.no> References: <20130918101235.e1737d4bd839f71ebf554803@getmail.no> Content-Type: text/plain; charset="us-ascii" Date: Wed, 18 Sep 2013 07:40:26 -0600 Message-ID: <1379511626.1197.69.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-arm@FreeBSD.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Sep 2013 17:03:10 -0000 On Wed, 2013-09-18 at 10:12 +0200, Torfinn Ingolfsen wrote: > I compiled stm32flash[1] under FreeBSD 8.4-STABLE: > 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 > > The resulting binary appears to work: > 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 > > I have an STM32 board connected to cuaU0/ttyU0: > 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 > > and my user has access: > tingo@kg-core1$ id > uid=1001(tingo) gid=1001(users) groups=1001(users),0(wheel),5(operator) > > Still it doesn't work: > 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 > > t 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? > > References: > 1) http://code.google.com/p/stm32flash/ With a quick glance at the stm32flash source I'm not seeing anything unusual about the way it handles the serial port. It might be useful to try "truss ./stm32flash /dev/cuaU0" and see what call it fails on and what the call args are. -- Ian