Skip to content

Commit

Permalink
Fixed PiZero2
Browse files Browse the repository at this point in the history
  • Loading branch information
pottendo committed Feb 4, 2024
1 parent 6989137 commit a0b3302
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#
# if you switch from legacy build to circle build 'make clean' is mandatory
#
# here some features can be disabled, as they may not work on the specific Pi model in circle builds
# e.g. NOPWMSOUND needed for PiZero (has no 3.5mm Jack) as it clashes with Wifi
# DISABLE ?= -DNOPWMSOUND

CIRCLEBASE ?= ../circle-stdlib
CIRCLEHOME ?= $(CIRCLEBASE)/libs/circle
Expand Down Expand Up @@ -61,6 +64,10 @@ ifeq ($(strip $(RASPPI)),3)
ifeq ($(strip $(AARCH)),64)
TARGET_CIRCLE ?= kernel8.img
else
ifneq ($(PIZERO2W),)
TARGET_PZ2 ?= -PZ2W
DISABLE ?= -DNOPWMSOUND
endif
TARGET_CIRCLE ?= kernel8-32.img
COMMON_OBJS += SpinLock.o
endif
Expand Down Expand Up @@ -91,8 +98,8 @@ all: $(TARGET_CIRCLE)
legacy: $(TARGET)

$(TARGET_CIRCLE): circlebuild
$(MAKE) -C $(SRCDIR) -f Makefile.circle COMMON_OBJS="$(COMMON_OBJS)" CIRCLE_OBJS="$(CIRCLE_OBJS)"
@cp $(SRCDIR)/$@ .
$(MAKE) -C $(SRCDIR) -f Makefile.circle COMMON_OBJS="$(COMMON_OBJS)" CIRCLE_OBJS="$(CIRCLE_OBJS)" XFLAGS="$(DISABLE)"
@cp $(SRCDIR)/$@ ./`basename $@ .img`$(TARGET_PZ2).img

$(TARGET): $(OBJS_LEGACY) $(LIBS)
@echo " LINK $@"
Expand All @@ -104,7 +111,7 @@ uspi/libuspi.a:
$(MAKE) -C uspi

clean:
$(Q)$(RM) $(OBJS_LEGACY) $(OBJS_CIRCLE) $(TARGET).elf $(TARGET).map $(TARGET).lst $(TARGET).img $(TARGET_CIRCLE)
$(Q)$(RM) $(OBJS_LEGACY) $(OBJS_CIRCLE) $(TARGET).elf $(TARGET).map $(TARGET).lst $(TARGET).img $(TARGET_CIRCLE) *.img
$(MAKE) -C uspi clean
$(MAKE) -C $(SRCDIR) -f Makefile.circle clean

16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,18 @@ make
# now build Pi1541 based on circle
cd ${BUILDDIR}/pottendo-Pi1541
make
# for PiZero2W you need to disable PWM sound, as it won't work anyway without 3.5mm jack
# make PIZERO2=1
```
Depending on the RPi Model and on the chosen build (Circle vs. legacy):
| Model | Version | build cmd | Image Name |
|----------|-----------|----------- |----------------|
| Pi Zero, 1RevXX, 2, 3 | legacy build | `make RASPPI={0,1BRev1,1BRev2,1BPlus,2,3} legacy` | `kernel.img` |
| Pi Zero 2W, 3 | circle build | `make` | `kernel8-32.img` |
| 3 | circle build | `make` | `kernel8-32.img` |
| Pi Zero 2W | circle build | `make PIZERO2W=1` | `kernel8-32-PZ2W.img` |
| Pi 4 | circle build | `make` | `kernel7l.img` |

*Hint*: in case you want to alternatively build for circle-lib and legacy make sure to `make clean` between the builds!
Expand All @@ -140,7 +146,15 @@ hdmi_group=2
#hdmi_mode=4
hdmi_mode=16
# uncomment as needed for your model/kernel
# Pi 3
kernel=kernel8-32.img
# Pi Zero 2W
#kernel=kernel8-32-PZ2W.img
# Legacy kernal all models
#kernel_address=0x1f00000
#kernel=kernel.img
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.circle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ADDONINC = -I$(CIRCLEHOME)/addon/linux
CFLAGS += -D__CIRCLE__ -I. -I./Circle -I "$(NEWLIBDIR)/include" \
-I $(STDDEF_INCPATH) -I $(CIRCLEBASE)/include $(ADDONINC) \
-Wno-psabi -Wno-write-strings -Wno-unused-variable -Wno-unused-but-set-variable -Wno-address \
-DRPI3=1
-DRPI3=1 $(XFLAGS)
AFLAGS = -march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -marm -DRPI3=1 -DDEBUG=1

# -mno-unaligned-access \
Expand Down
4 changes: 2 additions & 2 deletions src/circle-kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CKernel::CKernel(void) :
m_pKeyboard (0),
m_EMMC (&mInterrupt, &mTimer, &m_ActLED),
m_I2c (0, true),
#if RASPPI <= 4
#if !defined NOPWMSOUND && RASPPI <= 4
m_PWMSoundDevice (&mInterrupt),
#endif
m_WLAN (_FIRMWARE_PATH),
Expand Down Expand Up @@ -354,7 +354,7 @@ TKernelTimerHandle CKernel::timer_start(unsigned delay, TKernelTimerHandler *pHa
//extern const unsigned char *Sample_bin;
void CKernel::playsound(void)
{
#if RASPPI <= 4
#if !defined NOPWMSOUND && RASPPI <= 4
if (m_PWMSoundDevice.PlaybackActive())
return;
m_PWMSoundDevice.Playback ((void *)Sample_bin, Sample_bin_size, 1, 8);
Expand Down
2 changes: 1 addition & 1 deletion src/circle-kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class CKernel
CDevice *pUMSD1;
CEMMCDevice m_EMMC;
CI2CMaster m_I2c;
#if RASPPI <= 4
#if !defined NOPWMSOUND && RASPPI <= 4
CPWMSoundDevice m_PWMSoundDevice;
#endif
FATFS m_FileSystem;
Expand Down

0 comments on commit a0b3302

Please sign in to comment.