Close

STM8 eForth transfer tool in Python - Test with Windows, anybody?

A project log for eForth for cheap STM8S gadgets

Turn cheap modules from AliExpress into interactive development kits!

thomasThomas 10/22/2017 at 16:180 Comments

The use case for @RigTig 's script loadserial.py has been merged with an improved codeloadTCP.py. The new script codeload.py can be used for Forth code transfer and test automation (serial, telnet). It emulates most of the features of Manfred Mahlow's e4thcom (not the assembler, though), and it can also be used for making flat Forth files. (expansion of #include, #require, and \res with the tracefile feature).

Code transfer works with serial interface(2 or 3 wire), or telnet connection to uCsim. There is also a "dry run" mode which just dumps code to the console.

The script uses the Python argparse library, which results in a nice command line interface with a decent help function:

thomas@w500:~/source/stm8s/stm8ef$ tools/codeload.py -h
usage: codeload.py [-h] [-p port] [-t tracefile] [-q]
                   {serial,telnet,dryrun} [files [files ...]]
positional arguments:
  {serial,telnet,dryrun}
                        transfer method
  files                 name of one or more files to transfer
optional arguments:
  -h, --help            show this help message and exit
  -p port, --port port  PORT for transfer, default: /dev/ttyUSB0,
                        localhost:10000
  -t tracefile, --trace tracefile
                        write source code (with includes) to tracefile
  -q, --quiet           don't print status messages to stdout

The script assumes Python 2.7, and under Linux x86-64 it just works (desktop, and Travis-CI with Docker). I'm not a Python programmer, and sometimes I assume portability features similar to Java (which Python doesn't have).

It would be really nice if someone could review the script for portability, and test it under Windows. Please expect an issue, or two.

Discussions