linux support

Questions about the BASICtools and MakeItC
brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

linux support

Post by brucee »

using some quick & dirty perl adaptations for linux of getvectors.c
and upload.c, i was trying the linux versions of the ARMbasic compilers
(6.22 and 7.20) and both seem to work well.

the only problem is that when i upload the hex code i apparently
have to wait approx 100ms after each line and additionally approx
one second after each block. otherwise either the upload hangs (i
never get a '+' back) or the program becomes apparently corrupted
(user prog crashes or corrupt string data).

Could somebody provide more specific info about the upload
protocol/timing requirements?

im using ARMexpress LITE <-> FT232RL <-> USB @ linux (x86_64 RHEL 5).

thanks
thomas



brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

> Could somebody provide more specific info about the upload
> protocol/timing requirements?
>
> im using ARMexpress LITE <-> FT232RL <-> USB @ linux (x86_64 RHEL 5).

You should be able to run the lines out as fast as possible. I have
seen baud rates of nearly 1Mb work reliably (IFF the connection is
short, meaning don't try it through even a 6' RS-232 cable)

Between blocks marked by :0100000FF all communication should cease
until the ARMexpress responds with a + sign. Later firmware version
completely give up on XON/XOFF as when combined with USB it was
overrunning.

Now I know this works on the PC, but the driver can introduce a lot of
variation, so I don't know what Linux may do. If you want to try the
Tcl, I'll send over the latest.

Let me know how I can help, we can't support Linux as we really don't
use it here, so don't know much about it.

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

Bruce, thanks for your help.

The problem was my mistake, i didnt handle interrupted system calls
while writing to the serial interface. The getvectors.pl and upload.pl
work now and i can compile & upload under linux -- no need for VMware
anymore ;)

If you think the two scripts might be of interest for others here,
i can (try to) upload then to the files section...

thomas

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

> The problem was my mistake, i didnt handle interrupted system calls
> while writing to the serial interface. The getvectors.pl and upload.pl
> work now and i can compile & upload under linux -- no need for VMware
> anymore ;)
>
> If you think the two scripts might be of interest for others here,
> i can (try to) upload then to the files section...

Please upload the files, it gets closer to a set of tools running
natively on Linux. If someone wants to have a go at porting BASICtools
itself, we are more than happy to help out. BASICtools is written in
Tcl and should move to Linux fairly quickly.

On the Mac we ran into a show-stopper, while BASICtools moved over
quite easily, the problem is that Tcl on the Mac does not support
serial devices, so there's no way for us to talk to anything. So for
now to run on the Mac you need to run parallels or something similar.

For now we don't intend to support tools on Mac or Linux, as if you ask
us a question beyond the simplest we will basically give you a dumb-
founded looks as we are newbies on those systems.

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

I will upload the files later this week.
I want to add plain C versions.

However, i've got a some more questions.

(1) What is the end of greetings to look for before sending
the first "command"? Is there any rule what line terminators
will be used?

For the ARMexpress and two ARMexpress LITE i have laying around
here to play with, after sending \003 and "\n?\n", i get the
responses:

<4><10>Welcome back to ARMbasic[6.24] Copyright 2007,
Coridium Corp.<10><3><10>?<10>0624<10>...
<4><10>Welcome back to ARMbasic Kernel[6.19b] Copyright
2007, Coridium Corp.<10> <13>?<13>0619<13><10>...
<4><10>Welcome back to ARMbasic Kernel[7.09] Copyright
2007, Coridium Corp.<10><3><10>?<10>0709<10>...

It looks, the greeting to be skipped is always "\004\nSOMETEXT\n"
and, after receiving another "\n" one more character (for 6.24
and 7.09 but not 6.19 this appears to be the \003 or \033 used
to escape after reset) and "\r" or "\n" is sent back.
Following lines are terminated by "\r" or "\n" or both.

(2) Looking at the vectors it appears the first few are
FW_version, number_of_vectors_to_follow, lpc_chip_type...
Is this correct?
Any other useful info here (like max code/data sizes)?

(3) I remember to have read somewhere that baud rate is limited
to 19200 on the SIN/SOUT of ARMexpress due to 232 level converters
and i got confused by your previous post talking about much more.
What is the maximum speed to be used for uploading hex code?

(4) In my earlier upload attempts sending corrupted data i got
programs that started and crashed on the ARMexp or started and
used corrupted data.
Aren't there any checksums for the uploaded hex code?
How can i be sure that the upload was clean?

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

> It looks, the greeting to be skipped is always "\004\nSOMETEXT\n"
> and, after receiving another "\n" one more character (for 6.24
> and 7.09 but not 6.19 this appears to be the \003 or \033 used
> to escape after reset) and "\r" or "\n" is sent back.
> Following lines are terminated by "\r" or "\n" or both.

I wouldn't worry about versions prior to 7, as most people have
converted or will convert if they are actively using it.

After reset any user program will start up, unless a clt-C or ESC is
received within the first 500 ms or 1 s for wireless versions.
Assuming your program is running with the intent of changing the
program (a good assumption) you should probably send either character
to halt the program. Messages may change, will always be terminated
by a \n, but best is probably just to have a short timeout.

>
> (2) Looking at the vectors it appears the first few are
> FW_version, number_of_vectors_to_follow, lpc_chip_type...
> Is this correct?

that's correct

> Any other useful info here (like max code/data sizes)?

next 2 are start of DATA statements (which ends program if they exist)
and start of the user code (both shifted by 4)
followed by board type --

> (3) I remember to have read somewhere that baud rate is limited
> to 19200 on the SIN/SOUT of ARMexpress due to 232 level converters
> and i got confused by your previous post talking about much more.
> What is the maximum speed to be used for uploading hex code?

The transistor circuit of the ARMexpress or LITE, is slow when
driving a cable, but when its only an inch of PCB trace like on the
eval card it can run at 115Kb, probably faster. BUT IF USING A
CABLE, 38.4Kb is the limit.

> (4) In my earlier upload attempts sending corrupted data i got
> programs that started and crashed on the ARMexp or started and
> used corrupted data.
> Aren't there any checksums for the uploaded hex code?

Version 7 does do checksum checking. It echoes ! if it sees an
error. At one point I was thinking of doing retransmits, but there
doesn't seem to be a need to, it usually works or not, not much in
between. This seems to be the case for even wireless.

> How can i be sure that the upload was clean?

Like I say it does not seem to be an issue.

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

Bruce, thanks for your explanations.

I uploaded first versions of the basic compiler support scripts
(getvectors & upload hexcode) in perl and c to the files section.
they seem to work fine on my linux machine but still need some cleanup.
they should be fairly portable on unixoide systems...

Another question: To update my firmware can i order that $20 FW update
from the Coridium web page? Will that run in a VMware Win XP (i have
no native windows anywhere)??

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

> I uploaded first versions of the basic compiler support scripts
> (getvectors & upload hexcode) in perl and c to the files section.
> they seem to work fine on my linux machine but still need some cleanup.
> they should be fairly portable on unixoide systems...

The only issue I can see running this from a command line in Linux is
that you won't have access to the pre-processor. Without it you won't
be able to include library files for hardware support.

Of course cpp does exist on Linux, but it can't deal with BASIC style
comments where ' is equivalent to //

BASICtools chases down all the included files, strips those comments
and puts them in a temporary directory, then runs cpp on it. This
could probably be done with a sed script or something simple in perl.
That's why it probably makes sense to port the BASICtools Tcl to
Linux, which I don't expect to be a big issue. Also the logicscope
and variable dump feature would be missing without BASICtools.

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

--- In ARMexpress@yahoogroups.com, "basicnode" <bruce@...> wrote:
>
> The only issue I can see running this from a command line in Linux is
> that you won't have access to the pre-processor. Without it you won't
> be able to include library files for hardware support.
>
That's true but relatively easy to fix via sed + cpp.

> ... That's why it probably makes sense to port the BASICtools Tcl to
> Linux, which I don't expect to be a big issue. Also the logicscope
> and variable dump feature would be missing without BASICtools.
>
I completely agree with that. I just never did anything useful with tcl,
so it would take me longer then just a night to port it. I wont be
available till October but i may give it a try once i find some time...

brucee
Site Admin
Posts: 33
Joined: Thu Dec 18, 2008 8:45 pm

Re: linux support

Post by brucee »

> --- In ARMexpress@yahoogroups.com, "basicnode" <bruce@> wrote:
> >
> > The only issue I can see running this from a command line in Linux is
> > that you won't have access to the pre-processor. Without it you won't
> > be able to include library files for hardware support.
> >
> That's true but relatively easy to fix via sed + cpp.
>

Apparently the ' comments in basic behave the same way
(eg. qouted inside strings) as the // comments in C.
Is this correct?

(the basic help is not too specific about the behaviour of quoted
comments and quoted quotes)

If true, we can just replace ' by // and let cpp worry about the
quoting & nesting issues.

Something along these lines may work:

cat program.bas quit.bas |sed -e's/\x27.*$/\/\//' |cpp -nostdinc -I
basic_lib_dir - - |cat vectors - |ARMbasic > program.hex

Post Reply