Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9b5ae73
Add pawn library and app
pipe01 Dec 27, 2025
1f666e5
Add support for event handlers
pipe01 Dec 28, 2025
f52443f
Move program data array to function
pipe01 Dec 28, 2025
ee46e43
Assert parameter count; set style properties
pipe01 Dec 28, 2025
70e3ec1
Fix task cleanup
pipe01 Dec 28, 2025
da76720
Set fonts and alignment
pipe01 Dec 28, 2025
2bf5a2d
Proper program loading
pipe01 Dec 28, 2025
59b222c
Add sprintf implementation and watchface stuff
pipe01 Dec 29, 2025
3aebf4b
Use numbered natives instead of named
pipe01 Dec 29, 2025
09d0538
Put program in flash
pipe01 Dec 29, 2025
e8f97d2
Make watchface program smaller
pipe01 Dec 29, 2025
a96de3c
Load program using overlays
pipe01 Dec 29, 2025
8cdc948
Load non-overlayed programs
pipe01 Dec 29, 2025
dc0923c
Show status icons
pipe01 Dec 29, 2025
4ad16fd
Move overlay max size constant to top
pipe01 Dec 29, 2025
e4148e7
Add error handling
pipe01 Dec 29, 2025
8544ad7
Handle touch gestures
pipe01 Dec 29, 2025
2a7e5ed
Modify amxpool to use a struct rather than global vars
pipe01 Dec 30, 2025
fbbe598
Replace watchface
pipe01 Dec 30, 2025
56fa587
Rewrite digital watchface in pawn and add pawn scripts
pipe01 Dec 30, 2025
ac0b81e
Add assembly trampoline to handle native functions more compactly
pipe01 Dec 30, 2025
3716c9b
Run program directly from ROM
pipe01 Dec 30, 2025
bf82df3
Load programs from external flash files
pipe01 Dec 31, 2025
d6b16fb
Guard execution if errored
pipe01 Dec 31, 2025
db17adf
Use unique_ptr for status icons
pipe01 Dec 31, 2025
5c4d580
Add heatshrink compression
pipe01 Jan 8, 2026
d8a93a5
Merge branch 'main' into pawn
pipe01 Jan 9, 2026
4e16575
Remove debug stuff
pipe01 Jan 9, 2026
90283b5
Compile pawn apps to resources
pipe01 Jan 11, 2026
e7de0dc
Add list of pawn apps present in external flash
pipe01 Jan 11, 2026
cd0d64f
Fix invalid file handling
pipe01 Jan 11, 2026
1afc174
Move digital watchface to resources
pipe01 Jan 11, 2026
a8d5990
Remove assembly trampoline
pipe01 Jan 11, 2026
661b0a2
Compile pawn without linux macros
pipe01 Jan 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
shell: bash
run: |
git config --global --add safe.directory /__w/InfiniTime/InfiniTime
/opt/build.sh all
/__w/InfiniTime/InfiniTime/docker/build.sh all
- name: Output build size
id: output-sizes
shell: bash
Expand Down
10 changes: 10 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ main() {
[ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ] && GetGcc
[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ] && GetNrfSdk
[ ! -d "$TOOLS_DIR/mcuboot" ] && GetMcuBoot
[ ! -f "$TOOLS_DIR/pawn/pawncc" ] && GetPawn

mkdir -p "$BUILD_DIR"

Expand All @@ -49,6 +50,15 @@ main() {
return $BUILD_RESULT
}

GetPawn() (
set -e
git clone -b v4.1.7152 https://codeberg.org/compuphase/pawn.git $TOOLS_DIR/pawn
mkdir $TOOLS_DIR/pawn/build
cd $TOOLS_DIR/pawn/build
cmake ..
make -j $(nproc) pawncc
)

GetGcc() {
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/$GCC_ARM_VER/$GCC_ARM_PATH-$MACHINE-linux.tar.bz2 -O - | tar -xj -C $TOOLS_DIR/
if [ ! -d "$TOOLS_DIR/$GCC_ARM_PATH" ]; then
Expand Down
53 changes: 51 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ set(LVGL_SRC
libs/lvgl/src/lv_widgets/lv_win.c
)

list(APPEND PAWN_SRC
pawn/amx.c
pawn/amxpool.c
pawn/heatshrink_decoder.c
)

list(APPEND IMAGE_FILES
displayapp/icons/battery/batteryicon.c
)
Expand Down Expand Up @@ -398,6 +404,8 @@ list(APPEND SOURCE_FILES
displayapp/screens/Alarm.cpp
displayapp/screens/Styles.cpp
displayapp/screens/WeatherSymbols.cpp
displayapp/screens/Pawn.cpp
displayapp/screens/PawnList.cpp
displayapp/Colors.cpp
displayapp/widgets/Counter.cpp
displayapp/widgets/PageIndicator.cpp
Expand Down Expand Up @@ -900,6 +908,47 @@ target_compile_options(lvgl PRIVATE
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)

# pawn
add_library(pawn STATIC ${PAWN_SRC})
target_include_directories(pawn SYSTEM PUBLIC . ../)
target_include_directories(pawn SYSTEM PUBLIC ${INCLUDES_FROM_LIBS})
target_compile_options(pawn PRIVATE
${COMMON_FLAGS}
-DNDEBUG
-DAMX_ANSIONLY
-DAMX_NODYNALOAD
-DAMX_DONT_RELOCATE

# -DAMX_ALIGN
# -DAMX_ALLOT
# -DAMX_DEFCALLBACK
-DAMX_CLEANUP
# -DAMX_CLONE
-DAMX_EXEC
# -DAMX_FLAGS
-DAMX_INIT
# -DAMX_MEMINFO
# -DAMX_NAMELENGTH
# -DAMX_NATIVEINFO
-DAMX_PUSHXXX
-DAMX_RAISEERROR
# -DAMX_REGISTER
-DAMX_SETCALLBACK
# -DAMX_SETDEBUGHOOK
# -DAMX_UTF8XXX
# -DAMX_XXXNATIVES
-DAMX_XXXPUBLICS
-DAMX_XXXPUBVARS
-DAMX_XXXSTRING
# -DAMX_XXXTAGS
# -DAMX_XXXUSERDATA
# -DAMX_VERIFYADDR
$<$<CONFIG:DEBUG>: ${DEBUG_FLAGS}>
$<$<CONFIG:RELEASE>: ${RELEASE_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>: ${CXX_FLAGS}>
$<$<COMPILE_LANGUAGE:ASM>: ${ASM_FLAGS}>
)

# LITTLEFS_SRC
add_library(littlefs STATIC ${LITTLEFS_SRC})
target_include_directories(littlefs SYSTEM PUBLIC . ../)
Expand All @@ -918,7 +967,7 @@ set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime
set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld")
add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES})
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME})
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl pawn littlefs infinitime_fonts infinitime_apps)
target_compile_options(${EXECUTABLE_NAME} PUBLIC
${COMMON_FLAGS}
${WARNING_FLAGS}
Expand Down Expand Up @@ -952,7 +1001,7 @@ set(IMAGE_MCUBOOT_FILE_NAME_BIN ${EXECUTABLE_MCUBOOT_NAME}-image-${pinetime_VERS
set(DFU_MCUBOOT_FILE_NAME ${EXECUTABLE_MCUBOOT_NAME}-dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}.zip)
set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld")
add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES})
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl littlefs infinitime_fonts infinitime_apps)
target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl pawn littlefs infinitime_fonts infinitime_apps)
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME})
target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
${COMMON_FLAGS}
Expand Down
20 changes: 20 additions & 0 deletions src/displayapp/DisplayApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,15 @@ void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction)
nextDirection = direction;
}

void DisplayApp::StartPawnApp(const char* path, DisplayApp::FullRefreshDirections direction) {
nextApp = Apps::Pawn;
nextDirection = direction;

int path_len = strlen(path);
nextPawnFile = new char[path_len + 1];
strcpy(nextPawnFile, path);
}

void DisplayApp::LoadNewScreen(Apps app, DisplayApp::FullRefreshDirections direction) {
// Don't add the same screen to the stack back to back.
// This is mainly to fix an issue with receiving two notifications at the same time
Expand Down Expand Up @@ -651,6 +660,17 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
case Apps::FlashLight:
currentScreen = std::make_unique<Screens::FlashLight>(*systemTask, brightnessController);
break;
case Apps::Pawn:
if (nextPawnFile) {
currentScreen =
std::make_unique<Screens::Pawn>(controllers, std::make_unique<Screens::Pawn::LfsFile>(controllers.filesystem, nextPawnFile));

delete nextPawnFile;
nextPawnFile = nullptr;
} else {
currentScreen = std::make_unique<Screens::Pawn>(controllers);
}
break;
default: {
const auto* d = std::ranges::find_if(userApps, [app](const AppDescription& appDescription) {
return appDescription.app == app;
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/DisplayApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ namespace Pinetime {
void PushMessage(Display::Messages msg);

void StartApp(Apps app, DisplayApp::FullRefreshDirections direction);
void StartPawnApp(const char* path, DisplayApp::FullRefreshDirections direction);

void SetFullRefresh(FullRefreshDirections direction);

Expand Down Expand Up @@ -131,6 +132,7 @@ namespace Pinetime {
void PushMessageToSystemTask(Pinetime::System::Messages message);

Apps nextApp = Apps::None;
char* nextPawnFile = nullptr;
DisplayApp::FullRefreshDirections nextDirection;
System::BootErrors bootError;
void ApplyBrightness();
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/UserApps.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "displayapp/screens/Alarm.h"
#include "displayapp/screens/Dice.h"
#include "displayapp/screens/Pawn.h"
#include "displayapp/screens/PawnList.h"
#include "displayapp/screens/Timer.h"
#include "displayapp/screens/Twos.h"
#include "displayapp/screens/Tile.h"
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/apps/Apps.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ namespace Pinetime {
Dice,
Weather,
PassKey,
Pawn,
PawnList,
QuickSettings,
Settings,
SettingWatchFace,
Expand Down
2 changes: 2 additions & 0 deletions src/displayapp/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ if(DEFINED ENABLE_USERAPPS)
set(USERAPP_TYPES ${ENABLE_USERAPPS} CACHE STRING "List of user apps to build into the firmware")
else ()
set(DEFAULT_USER_APP_TYPES "Apps::StopWatch")
set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Pawn")
set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::PawnList")
set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Alarm")
set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Timer")
set(DEFAULT_USER_APP_TYPES "${DEFAULT_USER_APP_TYPES}, Apps::Steps")
Expand Down
Loading
Loading