Hi there,
I'm trying to build via the Git Bash (an msys2 terminal) on my Windows 10 machine with the ARM compiler installed (arm-none-eabi). I'm using:
- arm-none-eabi-gcc.exe et al (Arm GNU Toolchain 12.2.MPACBTI-Rel1 (Build arm-12-mpacbti.34)) 12.2.1 20230214 (in my $PATH variable)
- cmake version 3.20.1
- ninja version 1.10.2
- Playdate SDK 2.0.0
- PLAYDATE_SDK_PATH set
I built with this, in the "Examples/Sprite Game/build" directory (which was empty):
build$ cmake -DCMAKE_TOOLCHAIN_FILE=$PLAYDATE_SDK_PATH/C_API/buildsupport/arm.cmake -GNinja -B. ..
This gives a "Platform not supported!" message from buildsupport/playdate_game.cmake:68. That's an if-else statement that checks for platform variables (specifically the cmake variables MSVC, APPLE and UNIX). I'm on none of those, at least we know from the error message that MSVC isn't true, so I added a case with CYGWIN and copied the body of the UNIX block, as in:
elseif(UNIX)
add_custom_command(
TARGET ${PLAYDATE_GAME_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/lib${PLAYDATE_GAME_NAME}.so
${CMAKE_CURRENT_SOURCE_DIR}/Source/pdex.so)
elseif(CYGWIN)
add_custom_command(
TARGET ${PLAYDATE_GAME_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/lib${PLAYDATE_GAME_NAME}.so
${CMAKE_CURRENT_SOURCE_DIR}/Source/pdex.so)
else()
message(FATAL_ERROR "Platform not supported!")
endif()
This makes it generate fine with the cmake command above, and running ninja
results in this:
$ ninja
[1/4] Building C object CMakeFiles/SpriteGame_DEVICE.dir/main.c.obj
[2/4] Building C object CMakeFiles/SpriteGame_DEVICE.dir/C_/PlaydateSDK/C_API/buildsupport/setup.c.obj
[3/4] Building C object CMakeFiles/SpriteGame_DEVICE.dir/game.c.obj
[4/4] Linking C executable SpriteGame_DEVICE.elf
c:/progra~2/armgnu~1/12977f~1.2mp/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: warning: SpriteGame_DEVICE.elf has a LOAD segment with RWX permissions
I figure it's a warning, so probably not a dealbreaker. And besides there's a SpriteGame.pdx folder that's been created. Clicking File -> Open in the simulator and selecting the pdx folder. It fails to boot, and there's a message in red saying "Update error: no such function 'update'".
So okay, I tried to use the objdump
and readelf
utilities in the ARM toolchain I installed to inspect the pdex.bin file created, but while they identify an elf header in the file, I cannot read the symbol table with them. In the build
folder, there's a .elf
file, and using readelf
on that reveals that there is an update function in that. The ARM toolchain doesn't support __declspec(dllexport)
, but I assume this isn't needed with their toolchain.
Any help would be appreciated, I don't feel like my tools are too outlandish here. I saw someone else got VS Code working, which is cool but they seem to have patched a different set of files in the SDK than me, and I don't like the VS Code cmake plugin.