Contact Form

Name

Email *

Message *

Search This Blog

Total Pageviews

Popular Posts

Translate

Sunday, November 14, 2021

Proof Of Concept: Initial integration of ficl into Zephyr

 I haven't been talking much lately, due to my diagnosis of Myasthenia Gravis and life's distractions, but since I'm planning on talking at Forth Day this year, this is an easy place to throw some notes.

Proof Of Concept: Initial integration of ficl into Zephyr

The Zephyr OS is a small-footprint kernel designed for use on resource-constrained and embedded systems. Integrating the Forth Inspired Command Language (ficl) provides an alternative, extensible diagnostic capability.

I have not gotten permission from my employer yet, so I will not mention them until I do, but I can mention the public recognition that I did receive for contributions to the Zephyr project:

"The Zephyr® Project strives to deliver the best-in-class RTOS for connected resource-constrained devices, built to be secure and safe." It has been an interesting adventure working with this group and all you have to do is get a pull request accepted by them to get this badge, but I shouldn't minimize the effort required to get their acceptance. I don't have any other open source projects where I have attempted to be this active, and trying to do this with a Forth project should prove to be even more interesting.

A friend of mine from when we worked at Apple got me this job, and he even promoted Forth as he introduced me to them, but for the most part, I've been too busy with my actual job to get much done with Forth yet. I tend to work at the intersection of hardware and software, so getting drivers written for all of the IoT devices we intend on using takes priority over "playing" with Forth.

The actual project I'm working existed when I started, using different hardware and we went through a couple iterations before we ended with with Zephyr running on a Silicon Labs EFM32 Pearl Gecko Starter Kit.

We were using Simplicity Studio before we jumped into Zephyr and I had an initial version of ficl running there:

ficl - Run the Forth Inspired Command Language
Usage: ficl
%: ficl

ok>

However, it did not do much of anything there and it was buried inside our proprietary code, so I can't even show you anything about how I accomplished that.

On Zephyr, I have the advantage of it being open source and it has a native_posix interface that made this initial POC relatively simple to accomplish in 1 day.

west build -b native_posix ../zephyr-tmo-sdk/modules/ficl/
...
./build/zephyr/zephyr.exe
*** Booting Zephyr OS build v2.6.0-rc2-124-gc8ccacef8f82  ***
loading CORE EXT words 
loading SEARCH & SEARCH-EXT words 
loading Johns-Hopkins locals 
loading MARKER 
loading ficl O-O extensions 
loading ficl utility classes 
loading ficl string class 
Ficl version 4.1.0
Nov 14 2021 
ok> 5 . 
5 ok> 

 The hardest part of this integration was described here: Using static libraries on a Zephyr RTOS Project. So, it was easy enough to come up with the following CMakeLists.txt test case:

# Copyright (c) 2021 Dennis Ruffer <daruffer@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ficl)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
target_sources(app PRIVATE src/ficlplatform/unix.c)
target_sources(app PRIVATE src/softcore.c)

There are a bunch of edits within ficl that I have to resolve and probably post back to it's source forge home and I found out I am dealing with 2 different versions:

$Id: main.c,v 1.3 2010/11/01 14:10:27 asau Exp $
$Id: main.c,v 1.2 2010/09/10 09:01:28 asau Exp $

Both of which are called FICL 4.1.0 October 2010, so there's some work to do there too.

You may also notice that the output came out on the terminal command line, rather than the serial port where everything is actually supposed to go, but it's a 1st step. More is yet to come at some later date.

Thanks for listening!

DaR


No comments:

Post a Comment