Author: robhamerling
Date: Tue Sep 2 06:24:03 2008
New Revision: 260
Modified:
trunk/tools/blink-an-led.cmd
Log:
Updates for most recent Dev2Jal Rexx script: version 0.0.46
Modified: trunk/tools/blink-an-led.cmd
==============================================================================
--- trunk/tools/blink-an-led.cmd (original)
+++ trunk/tools/blink-an-led.cmd Tue Sep 2 06:24:03 2008
@@ -31,24 +31,24 @@
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs /* load Rexx utilities */
-J = 'k:/c/Jalv2/JalV2.exe' /* compiler path (eCS) */
+JalV2 = 'k:/c/Jalv2/JalV2.exe' /* compiler path (eCS)
*/
if runtype = 'TEST' then do /* test mode */
- I = 'k:/jallib/test/' /* test include directory
*/
- O = '-Wno-all -s' I /* compiler options */
+ Include = 'k:/jallib/test/' /* test include
directory */
+ Options = '-Wno-all -s' Include /* compiler
options */
end
else do /* normal mode */
- I = 'k:/jallib/unvalidated/include/device/' /* SVN include directory */
- O = '-Wno-all -a nul -s' I /* no asm output */
+ Include = 'k:/jallib/unvalidated/include/device/' /* SVN include
directory */
+ Options = '-Wno-all -a nul -s' Include /* no asm
output */
end
if selection = '' then
- call SysFileTree I'1*.jal', pic, 'FO' /* list of device
includes */
+ call SysFileTree Include'1*.jal', pic, 'FO' /* list of device
includes */
else
- call SysFileTree I||selection, pic, 'FO' /* list of device
includes */
+ call SysFileTree Include||selection, pic, 'FO' /* list of device
includes */
if pic.0 < 1 then do
- say 'No appropriate device files found in directory' I
+ say 'No appropriate device files found in directory' Include
return 1
end
@@ -57,76 +57,97 @@
do i=1 to pic.0
- parse value filespec('Name', pic.i) with M '.jal'
- say M
+ parse value filespec('Name', pic.i) with PicName '.jal'
+ say PicName
- '@python jsg_validator.py' pic.i '>'m'.pylog'
+ '@python jsg_validator.py' pic.i '>'PgmName'.pylog'
if rc \= 0 then do
- say 'returncode of validation include file' M'.jal is:' rc
+ say 'returncode of validation include file' PicName'.jal is:' rc
exit rc
end
- '@erase' m'.pylog' /* when OK, discard log */
+ '@erase' PgmName'.pylog' /* when OK, discard log */
- B = 'b'M'.jal' /* source file to create */
- call stream B, 'c', 'open write replace'
- call lineout B, '--
------------------------------------------------------'
- call lineout B, '-- Title: Blink-an-LED of the Microchip PIC'M
- call lineout B, '--'
- call lineout B, '-- Author: Rob Hamerling, Copyright (c) 2008..2008, all
rights reserved.'
- call lineout B, '--'
- call lineout B, '-- Adapted-by:'
- call lineout B, '--'
- call lineout B, '-- Compiler: =2.4'
- call lineout B, '--'
- call lineout B, '-- This file is part of jallib',
+ PgmName = 'b'PicName /* program name */
+ PgmFile = 'b'PicName'.jal' /* program filespec */
+ call stream PgmFile, 'c', 'open write replace'
+ call lineout PgmFile, '--
------------------------------------------------------'
+ call lineout PgmFile, '-- Title: Blink-an-LED of the Microchip
PIC'PicName
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Author: Rob Hamerling, Copyright (c)
2008..2008, all rights reserved.'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Adapted-by:'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Compiler: =2.4'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- This file is part of jallib',
' (http://jallib.googlecode.com)'
- call lineout B, '-- Released under the BSD license',
+ call lineout PgmFile, '-- Released under the BSD license',
'(http://www.opensource.org/licenses/bsd-license.php)'
- call lineout B, '--'
- call lineout B, '-- Description: Sample blink-an-LED program for
Microchip PIC'M
- call lineout B, '--'
- call lineout B, '-- Sources:'
- call lineout B, '--'
- call lineout B, '-- Notes:'
- call lineout B, '-- - File creation date/time:' date('N') time('N')'.'
- call lineout B, '--'
- call lineout B, '--
------------------------------------------------------'
- call lineout B, '--'
- call lineout B, 'include' M ' -- target PICmicro'
- call lineout B, '--'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Description: Sample blink-an-LED program for
Microchip PIC'PicName
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Sources:'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- Notes:'
+ call lineout PgmFile, '-- - File creation date/time:' date('N')
time('N')'.'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '--
------------------------------------------------------'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, 'include' PicName ' -- target
PICmicro'
+ call lineout PgmFile, '--'
call SysFileSearch 'pragma fuse_def OSC', pic.i, osc.
if osc.0 > 0 then do /* oscillator
pragma present */
call SysFileSearch 'HS =', pic.i, osc.
if osc.0 > 0 then do /* HS mode
supported */
- call lineout B, '-- This program assumes a 20 MHz resonator or
crystal'
- call lineout B, '-- is connected to pins OSC1 and OSC2.'
- call lineout B, 'pragma target OSC HS -- HS crystal or
resonator'
- call lineout B, 'pragma target clock 20_000_000 -- oscillator
frequency'
+ call lineout PgmFile, '-- This program assumes a 20 MHz resonator or
crystal'
+ call lineout PgmFile, '-- is connected to pins OSC1 and OSC2.'
+ call lineout PgmFile, 'pragma target OSC HS -- HS
crystal or resonator'
+ call lineout PgmFile, 'pragma target clock 20_000_000 --
oscillator frequency'
end
else do /* assume internal
oscillator */
- call lineout B, '-- This program assumes the internal oscillator'
- call lineout B, '-- is used with a frequency of 4 MHz.'
- call lineout B, 'pragma target OSC INTOSC_NOCLKOUT -- internal
oscillator'
- call lineout B, 'pragma target clock 4_000_000 -- oscillator
frequency'
+ call lineout PgmFile, '-- This program assumes the internal
oscillator'
+ call lineout PgmFile, '-- is used with a frequency of 4 MHz.'
+ call lineout PgmFile, 'pragma target OSC INTOSC_NOCLKOUT --
internal oscillator'
+ call lineout PgmFile, 'pragma target clock 4_000_000 --
oscillator frequency'
+ call SysFileSearch ' IOSCFS ', pic.i, ioscfs.
+ if ioscfs.0 > 0 then
+ call lineout PgmFile, 'pragma target IOSCFS F4MHZ --
select 4 MHz'
end
end
else do
- call lineout B, '-- This program assumes the internal oscillator'
- call lineout B, '-- is used with a frequency of 4 MHz.'
- call lineout B, 'pragma target clock 4_000_000 -- oscillator
frequency'
+ call lineout PgmFile, '-- This program assumes the internal oscillator'
+ call lineout PgmFile, '-- is used with a frequency of 4 MHz.'
+ call lineout PgmFile, 'pragma target clock 4_000_000 --
oscillator frequency'
+ call SysFileSearch ' IOSCFS ', pic.i, ioscfs.
+ if ioscfs.0 > 0 then
+ call lineout PgmFile, 'pragma target IOSCFS F4MHZ -- select
4 MHz'
end
call SysFileSearch 'pragma fuse_def WDT', pic.i, wdt.
if wdt.0 > 0 then do
- call lineout B, 'pragma target WDT disabled'
+ call lineout PgmFile, 'pragma target WDT disabled'
end
- call SysFileSearch 'pragma fuse_def LVP', pic.i, wdt.
- if wdt.0 > 0 then do
- call lineout B, 'pragma target LVP disabled'
+ call SysFileSearch 'pragma fuse_def LVP', pic.i, lvp.
+ if lvp.0 > 0 then do
+ call lineout PgmFile, 'pragma target LVP disabled'
+ end
+ call SysFileSearch 'pragma fuse_def MCLR', pic.i, mclr., 'N'
+ if mclr.0 > 0 then do
+ ln = linein(pic.i, word(mclr.1,1) + 1) /* line after
fuse_def */
+ if pos('EXTERNAL',ln) > 0 then do /* MCLR external */
+ call lineout PgmFile, 'pragma target MCLR external'
+ end
+ else do
+ ln = linein(pic.i) /* try next line */
+ if pos('EXTERNAL',ln) > 0 then do /* MCLR external */
+ call lineout PgmFile, 'pragma target MCLR external'
+ end
+ end
end
- call lineout B, '--'
- call lineout B, 'enable_digital_io() -- disable analog
I/O (if any)'
- call lineout B, '--'
- call lineout B, '-- You may want to change the selected pin:'
+ call stream Pic.i, 'c', 'close' /* done with
device file */
+ call lineout PgmFile, '--'
+ call lineout PgmFile, 'enable_digital_io() -- disable
analog I/O (if any)'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, '-- You may want to change the selected pin:'
port.0 = 3 /* ports to
scan */
port.1 = 'A'
@@ -138,10 +159,10 @@
if pin.0 > 0 then do /* pin found
*/
call SysFileSearch ' pin_'port.p||q'_direction', pic.i,
tris. /* TRISx */
if tris.0 > 0 then do /* found */
- call lineout B, 'var bit led is pin_'port.p||q' --
alias'
- call lineout B, 'var bit led_direction is pin_'port.p||
q'_direction'
- call lineout B, '--'
- call lineout B, 'led_direction = output'
+ call lineout PgmFile, 'var bit led is pin_'port.p||
q' -- alias'
+ call lineout PgmFile, 'var bit led_direction is pin_'port.p||
q'_direction'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, 'led_direction = output'
leave p
end
else do /* no TRISx
found */
@@ -152,55 +173,54 @@
end
if p > port.0 then do
- say ' Error: Could not find suitable I/O pin for LED on' M
+ say ' Error: Could not find suitable I/O pin for LED on' PicName
iterate
end
- call lineout B, '--'
- call lineout B, 'forever loop'
- call lineout B, ' led = on'
- call lineout B, ' _usec_delay(250000)'
- call lineout B, ' led = off'
- call lineout B, ' _usec_delay(250000)'
- call lineout B, 'end loop'
- call lineout B, '--'
- call stream B, 'c', 'close'
+ call lineout PgmFile, '--'
+ call lineout PgmFile, 'forever loop'
+ call lineout PgmFile, ' led = on'
+ call lineout PgmFile, ' _usec_delay(250000)'
+ call lineout PgmFile, ' led = off'
+ call lineout PgmFile, ' _usec_delay(250000)'
+ call lineout PgmFile, 'end loop'
+ call lineout PgmFile, '--'
+ call stream PgmFile, 'c', 'close'
- '@python jsg_validator.py' B '>'m'.pylog' /* validate blink program
*/
+ '@python jsg_validator.py' PgmFile '>'PgmName'.pylog' /* validate
blink program */
if rc \= 0 then do
- say 'returncode of validation blink program' B 'is:' rc
+ say 'returncode of validation blink program' PgmFile 'is:' rc
exit rc /* terminate! */
end
- '@erase' m'.pylog' /* when OK, discard log */
+ '@erase' PgmName'.pylog' /* when OK, discard log */
- '@'J O B '>b'M'.log' /* compile */
+ '@'JalV2 Options PgmFile '>'PgmName'.log' /* compile */
if rc \= 0 then /* compiler error */
leave /* terminate */
- B = 'b'M /* add 'B' prefix to name
*/
- '@erase' B'.cod' B'.err' B'.lst' B'.obj' '1>nul 2>nul'
+ '@erase' PgmName'.cod' PgmName'.err' PgmName'.lst' PgmName'.obj' '1>nul
2>nul'
- call SysFileSearch 'WARNING', B'.log', LG. /* find warning line in
log */
+ call SysFileSearch 'WARNING', PgmName'.log', LG. /* find warning line
in log */
if LG.0 > 0 then do
parse upper var LG.1 errs 'ERRORS,' wngs 'WARNINGS'
if errs = 0 & wngs = 0 then do
- if stream(B'.hex', 'c', 'query exists') = '' then do
+ if stream(PgmName'.hex', 'c', 'query exists') = '' then do
Say ' Zero warnings and errors, but no hex file. Compiler failure!'
end
else do
k = k + 1 /* all OK */
- '@copy' B'.jal' dst'*' '1>nul'
+ '@copy' PgmName'.jal' dst'*' '1>nul'
if runtype \= 'TEST' then
- '@erase' B'.hex' B'.asm' B'.jal' B'.log' '1>nul 2>nul'
+ '@erase' PgmName'.hex' PgmName'.asm' PgmName'.jal'
PgmName'.log' '1>nul 2>nul'
end
end
else
- say ' Compilation of' B'.jal failed:' LG.1
+ say ' Compilation of' PgmName'.jal failed:' LG.1
end
else do
- say 'Compilation of' B'.jal failed, file' B'.log' 'not found'
+ say 'Compilation of' PgmName'.jal failed, file' PgmName'.log' 'not
found'
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---