Page 1 of 1

Compiling from command line

Posted: Mon Oct 21, 2013 11:49 pm
by basicchip
BASICtools handles the steps necessary to compile a BASIC program into a hex file and then download that hex file to a target ARM processor

those steps are
- determine what CPU is being used and generate a #define LPC1756 or equivalent
- run the pre-processor
- prepend the vectors for the CPU being used.
- add "QUITDUMP" to the above output
- compile all that with ARMbasic.exe
- send the resulting hex file to the CPU

For the BLINKY.bas example

Blinky.bas uses the pre-processor.

bpp is not setup to use pipe input (source is at http://www.coridiumcorp.com/forum/viewt ... =bpp#p1178)

so you would have to create a 1 line (let us call it defLPC1756.bas) and it contains 1 line -

#define LPC1756 ' BASICtools now inserts this or the equivalent into all programs now

then do-

copy defLPC175x.bas+blinky.bas temp.bas

then

bpp temp.bas > temp.bpp

next another 1 line file (quitdump.bas) that is the 1 line

QUITDUMP

You also need a set of vectors from the SuperPRO or LPC4078 (they WILL be different and WILL change with different firmware versions). You can get those by typing a ? into the enter line of BASICtools and cutting and pasting the output into a file vectors.bas (when you use BASICtools this is in %temp%\coridium\__temp.bas)

Here is a command line program that gets the vectors (file attached here
getBASICvectors.exe
(30.01 KiB) Downloaded 1327 times
)

getBASICvectors > vectors.bas

copy vectors.bas+temp.bpp+quitdump.bas temp.ab

Compile that file and pipe the output to a downloader program (file attached here below)

ARMbasic.exe < temp.ab | loadBASIC com8

The compile and download is complete.

I'll post the source for these utilities next

Re: Compiling from command line

Posted: Mon Oct 21, 2013 11:58 pm
by basicchip
Sources for getBASICvectors and loadBASIC

These were compiled with minGW on a PC.

They handle resetting an attached ARM CPU, stopping any running BASIC program, and either getting some vectors or downloading a compiled hex file.

Both use simple timeouts to wait for the ARM to respond.
getBASICvectors.c
(7.2 KiB) Downloaded 1430 times
loadBASIC.c
(7.92 KiB) Downloaded 1411 times

Re: Compiling from command line

Posted: Tue Oct 22, 2013 12:01 am
by basicchip
Any linux or Unix people out there?

With these 2 tools and a version of the compiler and bpp all this would run in either a linux environment or on a Mac

I will attach versions of the compiler for linux and the Mac here.

Re: Compiling from command line

Posted: Tue Oct 22, 2013 1:40 am
by AMDlloydsp
Thanks, Bruce!

You just solved TWO problems for me in one post!

Now I also have the means to download new softs to several different SuperPros I have distributed around a machine, without having to connect each one to a USB port!

It'll take some coding, because I'm going to have one of the SuperPros SuperVise the process!

(methinks it'll require study, too... but that's fun!)
Lloyd