Flash apps#

CEUI works the same in a .8xp program and in a flash app. All of its state is zero-initialized memory, it has no initialized data of its own, and styles, glyphs, palettes and key maps are const, so in an app they stay in flash and cost no RAM.

Building an app#

Set APPLICATION = YES in the makefile, or on the command line:

NAME = HELLO
APPLICATION = YES

UI_THEME = default
include vendor/ceui/ui.mk
include $(shell cedev-config --makefile)
make APPLICATION=YES

The toolchain then builds an .8ek app image in bin/ instead of an .8xp. The calculator cannot take an .8ek directly; app_tools installs it from appvars. Split the image into appvars with convbin:

convbin --iformat 8ek --input bin/HELLO.8ek --oformat 8xv-split --maxvarsize 65200 --output bin/HELLOAP.8xv --name HELLOAP

Then build the installer in app_tools’ installer folder with the same prefix:

make -C app_tools/installer NAME=HELLOINS APPVAR_PREFIX=HELLOAP

Send the appvars and the installer program (HELLOINS.8xp) to the calculator, together with the CE libraries, and run the installer once. The app is then in the [apps] menu, and the appvars and installer can be deleted.

Nothing else changes in your code.

The app header workaround#

With CE C toolchain v15.0, convbin writes the size of .data plus .bss into the app header as the app’s data region. When TI-OS starts an app, it copies that many bytes from the app into RAM. Once the region is larger than about 8400 bytes, the copy overwrites memory the OS needs, and the calculator resets with “RAM Cleared” before the app’s first instruction. CEmu shows the same crash. It hits every app with enough initialized and zeroed data, which includes every LibLoad app whatever toolkit it uses, and a CEUI program has about 11 KB of .bss.

The app’s startup code copies .data and clears .bss by itself, so the header only needs to declare .data. When APPLICATION = YES, ui.mk runs convbin through tools/convbin-app, which calls the real convbin and then writes the size of .data, read from the program’s map file, into that header field (offset 0x166 of the .8ek). Apps then have the same RAM as programs. You do not need to do anything for it.

The wrapper needs a POSIX shell, awk and dd, which every Linux and macOS system has; on Windows, build in WSL or MSYS2. The real fix belongs in convbin, and once it is fixed the wrapper can go.

CEUI’s test suite installs hello and the full showcase, which has 19 KB of .bss, as apps, starts them from the [apps] menu and checks them against the same screenshots as the programs.