The CH32V033 is now able to execute the amForth XT words without any
problems, MounStudio with debugging allowed me to set program break points
to see the execution of each XT code segment along with the registers (tos,
ip, sp dp) so it looks very promising. The vendor's startup code and C
libraries are used to initialize system clocks, peripherals (usart,
GPIO...) this saves a tremendous amount of work.
The existing flash image contains the dictionary that the hifive
application used which is an overkill for what my application needs, so the
next step is to remove unnecessary dictionary entries e.g initialization
(commenting out the unnecessary include files) and rebuild the image.
The amForth codebase in CH32V033 will use the C library drivers for IO
(usart, gpio, pioc, networking ... ).  The CH32X033 chip also hosts an
additional eight bit RISC processor (pioc) which amForth can work with for
high speed custom IO. To test the amForth code and dictionary a test
sequence of XT tokens will be passed to the amForth VM (execution loop) and
monitor the results (tos ... ). The test environment is very simple, a
CH32V033 chip in a 20 pin chip adapter connected to a WCH-LinkE and using
MounStudio v2.3.0 for programming and debugging.

Hope this information is useful to others,
John S


On Tue, Jan 6, 2026 at 4:37 PM John Sarabacha <[email protected]> wrote:

> Hi Tristan,
> Some good news,  CH32V033 is now able to run amForth co-existing with C
> and other inline routines. A change was made to the the execution loop
> which doesn't impact performance and the keeps image size to a minimum.
> Next step is to test amForth using C code to pass ascii strings to the
> interpreter to see if it works.
>
> Regards,
> John S
>
>
>
> On Tue, Jan 6, 2026 at 3:14 PM John Sarabacha <[email protected]>
> wrote:
>
>> Hi Tristan,
>> This has and is being looked at. The linker appears to be the problem. I
>> have tried a few
>> things like changes to the macros with some success. With these successes
>> the image sizes grow.
>> The run time execution loop is able to function until it hits a halfword
>> address then it exceptions out.
>> As a temporary workaround I am looking at handling the exception
>> gracefully and resuming the execution
>> loop,  this way the image size can be kept smaller. The good news is that
>> it (amForth) is able to co-exist with
>> my existing application which is a mix of C and inline assembler routines.
>>
>> Regards,
>> John S
>>
>> On Tue, Jan 6, 2026 at 1:53 PM <[email protected]> wrote:
>>
>>> Hi John,
>>>
>>> Check your compiler/assembler/linker options to see whether they allow
>>> free reign to use RISC-V compressed instructions wherever they think
>>> appropriate. Then, as a first cut, turn that off globally. There are
>>> various ways to be more selective, but it very much depends on how much
>>> their use matters to you.
>>>
>>> Best wishes,
>>> Tristan
>>>
>>> On 2026-01-06 16:33, John Sarabacha wrote:
>>> > Hi everyone,
>>> > When mixing C *.c and assembler *.s files in your amForth build you
>>> can
>>> > run
>>> > into random 32 bit alignment issues with the dictionary.  The
>>> Cortex-M4
>>> > and
>>> > RISCV on CH32V307 appears to be more forgiving than CH32X033/CH32X035
>>> > is.
>>> > Using  the -m32 switch for GCC/assembler chain doesn't help. The
>>> > strange
>>> > part is that the 32 bit mis-alignment doesn't always occur.  It only
>>> > happens for certain dictionary elements like
>>> > 000015be <XT_DOLITERAL>:
>>> >     15be: 15c2
>>> > 000015c2 <PFA_DOLITERAL>:
>>> >
>>> > Regards,
>>> > John S
>>> >
>>> > _______________________________________________
>>> > Amforth-devel mailing list for http://amforth.sf.net/
>>> > [email protected]
>>> > https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>>
>>>
>>> _______________________________________________
>>> Amforth-devel mailing list for http://amforth.sf.net/
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/amforth-devel
>>>
>>

_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
[email protected]
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to