Subject:
Re: [gnupic] xwisp2 on FreeBSD
From:
Rob Hamerling ####@####.####
Date:
3 Jan 2006 14:27:15 +0000
Message-Id: <43BA89B8.1020503@robh.nl>
Xiaofan Chen wrote:
> Today I tried to port xwisp2 to my newly installed FreeBSD 6.0-RELEASE system
> and it is okay after I changed a bit on the compiler.h file and the
> xwisp2.h file.
> I think my changes can be a bit simpler.
>
> The only problem is that I can not use the default high baud rate of
> 115200. I can only use 57600.
>
> Regards,
> Xiaofan
>
> 1) change to compiler.h: add the following
>
> #elif defined( __FreeBSD_cc_version)
>
> #define compiler_name "GCC"
>
> #if defined(__GNUC__)
>
> #define compiler_version (__GNUC__)
>
> #elif defined(__VERSION__)
>
> #define compiler_version (__VERSION__[0] - '0') // first char
>
> #else
>
> #define compiler_version (0) // unknown
>
> #endif
>
> #if defined(__GNUC_MINOR__)
>
> #define compiler_minor (__GNUC_MINOR__)
>
> #elif defined(__VERSION__)
>
> #define compiler_minor (__VERSION__[2] - '0') // third character
>
> #else
>
> #define compiler_minor (0) // unknown
>
> #endif
>
> #define max(x,y) ((x > y) ? (x) : (y)) // missing ..
>
> #define min(x,y) ((x < y) ? (x) : (y)) // .. functions ..
>
> #define strnicmp strncasecmp // alias
>
> #define stricmp strcasecmp // alias)
>
> #define CBAUD 0010017 // For FreeBSD
> (not in POSIX)
>
> #define __LINUX__
> #define __FREEBSD__
>
> 2) changes to xwisp2.h: change a bit for cosmetics reason
> #elif defined(__LINUX__) || defined(__APPLE__) || defined(__FREEBSD__)
> // Linux or MacOS or FREEBSD
>
> typedef ULONG BOOLEAN;
>
> typedef int HSERIALPORT; // handle for I/O
>
> #define INVALIDSERIALHANDLE MINUS1
>
> #define ucDIRECTORYSEPARATOR '/'
>
> #define szDIRECTORYSEPARATOR "/"
>
> #define _searchenv(a,b,c) (*c=0) // nul: not used
>
> #if defined(__APPLE__)
>
> #define runtime_platform "MacOS"
>
> #elif defined(__FREEBSD__)
> #define runtime_platform "FreeBSD"
> #else
>
> #define runtime_platform "Linux"
>
> #endif
>
> 2) sample running session
>
> [xiaofan@myfreebsd xwisp2181s]$ gmake
> Compiling xwisp2.c
> Compiling xwisp2bus.c
> Compiling xwisp2cfg.c
> Compiling xwisp2cmd.c
> Compiling xwisp2com.c
> Compiling xwisp2dat.c
> Compiling xwisp2hex.c
> Compiling xwisp2mis.c
> Compiling xwisp2tgt.c
> Linking xwisp2u
> Compiling xwlist.c
> Linking xwlistu
>
> [xiaofan@myfreebsd xwisp2181s]$ ./xwisp2u verbose baud 115200 port
> /dev/ttyd0 verify wisp628a.hex xwisp2 version 1.8.01 for FreeBSD (Jan
> 3 2006, GCC 3.4)
> Will be using port /dev/ttyS0 at 19200 bps
> Will be using port /dev/ttyd0 at 19200 bps
> Reading file 'wisp628a.hex'
> File wisp628a.hex loaded and is Intel Hex format conforming
> Total of program and data memory: 3866 bytes
> Using serial port /dev/ttyd0
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> DTR On, RTS Off
> DTR Off, RTS Off
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> Programmer Wisp628, firmware version 1.10
> Switching Wbus speed from 19200 to 115200 bps
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 115200
> Trying 14 bits core family (provisional target 12F629)
> SendReceiveFast read timeout, received 0 of 5
> SendReceiveSlow read timeout, 0 bytes received
> Trying 16 bits core family (provisional target 18F1220)
> SendReceiveFast read timeout, received 0 of 5
> SendReceiveSlow read timeout, 0 bytes received
> DeviceID: FFFF
> Target not found in configuration table
> Target not auto-detected, please specify on commandline!
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> xwisp2 failed after 4.86 seconds, rc 23!
>
> [xiaofan@myfreebsd xwisp2181s]$ ./xwisp2u verbose baud 57600 port
> /dev/ttyd0 verify wisp628a.hex xwisp2 version 1.8.01 for FreeBSD (Jan
> 3 2006, GCC 3.4)
> Will be using port /dev/ttyS0 at 19200 bps
> Will be using port /dev/ttyd0 at 19200 bps
> Reading file 'wisp628a.hex'
> File wisp628a.hex loaded and is Intel Hex format conforming
> Total of program and data memory: 3866 bytes
> Using serial port /dev/ttyd0
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> DTR On, RTS Off
> DTR Off, RTS Off
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> Programmer Wisp628, firmware version 1.10
> Switching Wbus speed from 19200 to 57600 bps
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 57600
> Trying 14 bits core family (provisional target 12F629)
> Detected target: 16F628A revision 04 (ID=1064)
> Programming algorithm 4 (PIC16C)
> Verifying program memory......OK!
> Verifying ID memory...........OK!
> Verifying data memory.........OK!
> Verifying fuses memory........OK!
> Verify terminated successfully in 6.16 seconds
> Portspeed min: 50, max: 115200, cur: 0
> Portspeed new: 19200
> xwisp2 terminated successfully in 6.04 seconds
>
> [xiaofan@myfreebsd xwisp2181s]$ uname -a
> FreeBSD myfreebsd.mshome 6.0-RELEASE FreeBSD 6.0-RELEASE #0: Thu Nov
> 3 09:36:13 UTC 2005
> ####@####.#### i386
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
>
>
>
--
Rob Hamerling, Vianen, NL phone +31-347-322822
homepage: http://www.robh.nl/