Skip to content

Commit

Permalink
Fix the need to modify the Playdate SDK.
Browse files Browse the repository at this point in the history
It turns out that `LDFLAGS += --specs=nosys.specs` can actually be put into our makefile (after including common.mk) and does not need to be patched into common.mk. I originally assumed that that wouldn't work, because the rule using the variable comes before that definition, but it actually does because the variable is a recursively expanded one (evaluated at use), not a simply expanded one (evaluated at definition).
  • Loading branch information
cwalther committed May 31, 2024
1 parent d60227e commit 1889dad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ ULIBS =

include $(SDK)/C_API/buildsupport/common.mk

# Include dummy implementations of syscalls to fix linker errors like "undefined
# reference to `_write'"; I have not figured out yet where in MicroPython these
# references come from and whether they could be avoided.
LDFLAGS += --specs=nosys.specs

micropython_embed/port/micropython_embed.h: micropython/ports/embed/port/micropython_embed.h mpconfigport.h manifest.py
$(MAKE) -f micropython_embed.mk

Expand Down
19 changes: 1 addition & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,7 @@ Work in progress on running [PewPew](https://pewpew.readthedocs.io/) games on th

## How to build

1. Apply this [change](https://devforum.play.date/t/undefined-reference-to-exit-and-friends/7263/2) to your Playdate SDK to fix linker errors about undefined references to various functions
(I have not examined yet where exactly in MicroPython the references come from and whether they could be avoided):
```diff
--- PlaydateSDK/C_API/buildsupport/common.mk 2024-04-01 18:56:16
+++ PlaydateSDK/C_API/buildsupport/common.mk 2024-04-01 18:56:16
@@ -104,6 +104,9 @@

LDFLAGS = -nostartfiles $(MCFLAGS) -T$(LDSCRIPT) -Wl,-Map=$(OBJDIR)/pdex.map,--cref,--gc-sections,--no-warn-mismatch,--emit-relocs $(LIBDIR)

+# see https://devforum.play.date/t/undefined-reference-to-exit-and-friends/7263/2
+LDFLAGS += --specs=nosys.specs
+
# Generate dependency information
CPFLAGS += -MD -MP -MF $(DEPDIR)/$(@F).d

```

2. Clone this repository.
1. Clone this repository.
```sh
git clone https://github.com/cwalther/pew-playdate.git pewpew
cd pewpew
Expand Down

0 comments on commit 1889dad

Please sign in to comment.