Skip to content

Commit

Permalink
On behalf of: 3298 - Applied 23 patches by 3298:
Browse files Browse the repository at this point in the history
Misc changes, mostly fixes:
- fix ./newconfig systems other than OSX (broke in c8b823f)
- fix palette usage in 2-bit color mode (was broken ever since grayscale was implemented in 18e1003 and its improperly attributed copy f7913eb)
- fix continuing from breakpoints in the debugger (never worked, was exposed when the debugger was enabled in 9c1f2ed)
- restore the printf statements commented out in 9c1f2ed and hide them with #ifdefs instead
- close the server socket after accepting a debugger connection to allow another simultaneous debug session to be started using the same TCP port
- use the symbolic constant DEFAULT_GDBSTUB_PORT (already defined in gdb_stub.h as 1234) when starting the gdb server in main.c in place of the raw number 1234
- change Makefile to read the name of the firmware file from the file update.scp instead of hardcoding it; this allows users to switch to another firmware
by simply pasting it along with its accompanying update.scp into the x49gp directory

- Enhance port G (keyboard) handling to remember the value of output bits across periods with these bits configured as input
This fixes interaction with HPGCC3 keyboard routines, and it also fixes keys with eint==7 (assuming the stock firmware is in use)
needing a double-tap to work unless pressed very shortly after another keypress (the latter broke in b5f93ed)
- Get rid of the deprecated function warning by switching from gdk_pixbuf_new_from_inline to gdk_pixbuf_new_from_data (based on code by chwdt)
- Delete remaining now-redundant CVS files
- Don't release all buttons anymore if there are still physical keys and/or the left mouse button are holding some down
On the other hand, forcibly release all buttons when losing focus to avoid getting stuck in a state with buttons down
when they are not held down by anything; this would happen due to missed events while not in focus
- Add a context menu to the screen, containing only "Reset" and "Quit" items for now
- Ensure that the files backing flash, sram, and s3c2410-sram exist and have the correct size when opening them
Note that if the flash file does not exist, this will not fill it with the code that's supposed to be in there, obviously causing the calculator to crash. That's an improvement for later.
- Allow the config system to fill not only numbers, but also strings (including filenames) with default values
basename is excluded, but it's planned to be dropped entirely.
- Add an "install" target to the Makefile
- Implement a more generic command-line parser for substantially improved flexibility
- Also adds a proper help option, though the manual referenced in the corresponding output (a manpage, hopefully) does not exist yet.
- Drop the "basename" config property in favor of interpreting relative paths in the config as relative to the config file's location
- Retire the "image" config property in favor of simply loading the image from next to the binary or from the install directory
- Split the UI name property into name (affecting only the window title) and type (affecting the UI image and in the future also the default bootcode) properties
- Change the default calculator type to the 50g everywhere, which probably matches today's user expectations better than the 49g+.
- Create a flash file from the calculator model's appropriate boot file if it does not exist, relying on the bootcode to detect the absence of a firmware
  The bootcode will complain about the missing firmware and enter update mode, so the user needs to supply their favorite firmware version and point the bootcode's updater to it.
  The easiest way is probably pointing the emulated SD card at a directory containing the firmware and its accompanying update.scp file, and then starting the SD-based update.
- Add SD mount / unmount options to the right-click / menu-key popup menu
- Remove most of the old script-based config-generating system since the binary now has these capabilities as well
- Add an applications menu item for installing
- Keep some debug output on stderr and a huge vvfat.log file from showing up when not debugging x49gp itself
- Allow (re-)connecting a debugger to a running session
  This is done through the right-click / menu-key popup menu.
  To avoid confusion due to the accidental clicks leading to an unresponsive interface (caused by waiting for the debugger to connect),
  this option is hidden unless option -d or its new companion -D (same as -d, but does not start the debug interface right away) is present.
- Improved support for hardware keyboards
- Update README.md, add manpage, rename other README files to TODO to reflect their contents
  • Loading branch information
claudiol committed May 7, 2018
1 parent 91d85c5 commit c61f11c
Show file tree
Hide file tree
Showing 55 changed files with 1,289 additions and 760 deletions.
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
sim/CVS*
*.svn/*
*.DS_Store/*
.DS_Store
.depend
*.o
*.d
config
flash-49g+
flash-50g
flash-noboot
sdcard
sram
x49gp
s3c2410-sram
qemu/qemu-git/arm-softmmu
qemu/qemu-git/libhw32
qemu/qemu-git/libhw64
Expand Down
104 changes: 30 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,16 @@ X49GP_DEBUG = \
-DDEBUG_X49GP_TIMER_IDLE \
-DDEBUG_X49GP_ARM_IDLE \
-DDEBUG_X49GP_ENABLE_IRQ \
-DDEBUG_X49GP_BLOCK \
-DDEBUG_X49GP_MAIN \
-DDEBUG_X49GP_UI

DEBUG = -g # -pg

#2.09
#FIRMWARE = 4950_92.bin
#HPGCC3 (copy HPGCC3 ROM first)
#FIRMWARE = 49_hpgcc.bin
#2.15
#FIRMWARE = 4950_215.bin
#2.15full
FIRMWARE = 2MB_215f.bin

BOOT49GP = boot-49g+.bin
BOOT50G = boot-50g.bin
SERIAL49GP = DE00000001
SERIAL50G = DEA0000001
COPYRIGHT = Kinposhcopyright
IMAGE49GP = hp49g+.png
IMAGE50G = hp50g.png

QEMU_DEFINES = -DTARGET_ARM -DX49GP \
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
Expand Down Expand Up @@ -90,6 +82,13 @@ X49GP_INCLUDES = -Iinclude -Ibitmaps $(QEMU_INC)

INCLUDES = $(GDB_INCLUDES) $(X49GP_INCLUDES)

INSTALL_PREFIX = /usr/local
INSTALL_BINARY_DIR = "$(INSTALL_PREFIX)"/bin
INSTALL_DATA_DIR = "$(INSTALL_PREFIX)"/share/$(TARGET)
INSTALL_MENU_DIR = "$(INSTALL_PREFIX)"/share/applications
INSTALL_MAN_DIR = "$(INSTALL_PREFIX)/share/man/man1"
DEFINES += -DX49GP_DATADIR=\"$(INSTALL_DATA_DIR)\"

ifdef QEMU_OLD
CC = $(shell if [ "`uname -s`" = "Darwin" ]; then echo "gcc"; else echo "gcc-3.4"; fi)
else
Expand All @@ -103,7 +102,7 @@ CC += $(shell if [ "`uname -m`" = "sparc64" -o "`uname -m`" = "sun4u" ]; then ec

COCOA_LIBS=$(shell if [ "`uname -s`" = "Darwin" ]; then echo "-F/System/Library/Frameworks -framework Cocoa -framework IOKit"; fi)

CFLAGS = -O2 -Wall -Werror $(DEBUG) $(INCLUDES) $(DEFINES) -Wno-error=deprecated-declarations
CFLAGS = -O2 -Wall -Werror $(DEBUG) $(INCLUDES) $(DEFINES)
LDFLAGS = $(DEBUG) $(X49GP_LDFLAGS) $(GDB_LDFLAGS)
LDLIBS = $(X49GP_LIBS) $(GDB_LIBS) $(COCOA_LIBS)

Expand Down Expand Up @@ -158,12 +157,13 @@ VVFATOBJS += $(QEMU_DIR)/cutils.o
endif

TARGET = x49gp
TARGET_ALLCAPS = X49GP

all: do-it-all

ifeq (.depend,$(wildcard .depend))
include .depend
do-it-all: $(QEMU) $(TARGET) flash-49g+ flash-50g sram s3c2410-sram
do-it-all: $(QEMU) $(TARGET)
else
do-it-all: depend-and-build
endif
Expand All @@ -176,59 +176,20 @@ $(TARGET): $(OBJS) $(VVFATOBJS) $(QEMU_OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(VVFATOBJS) $(LDLIBS)
endif

flash-49g+: $(BOOT49GP) flash-noboot
@cp flash-noboot $@
@/bin/echo -n "$@: Copy boot loader \"$(BOOT49GP)\" to "; echo "0"
@dd if=$(BOOT49GP) of=$@ bs=16 seek=0 conv=notrunc 2>/dev/null
@/bin/echo -n "$@: Set serial number \"$(SERIAL49GP)\" at "; expr 16 \* 1023
@/bin/echo -n "$(SERIAL49GP)" >serialno
@dd if=serialno of=$@ bs=16 seek=1023 conv=notrunc 2>/dev/null
@rm -f serialno

flash-50g: $(BOOT50G) flash-noboot
@cp flash-noboot $@
@/bin/echo -n "$@: Copy boot loader \"$(BOOT50G)\" to "; echo "0"
@dd if=$(BOOT50G) of=$@ bs=16 seek=0 conv=notrunc 2>/dev/null
@/bin/echo -n "$@: Set serial number \"$(SERIAL50G)\" at "; expr 16 \* 1023
@/bin/echo -n "$(SERIAL50G)" >serialno
@dd if=serialno of=$@ bs=16 seek=1023 conv=notrunc 2>/dev/null
@rm -f serialno

flash-noboot: $(FIRMWARE)
@/bin/echo -n "$@: Fill ff: 0 "
@/bin/echo -ne "\377" >one
@COUNT=0; \
SIZE=1; \
while [ $${COUNT} -le 20 ]; do \
cat one one >one2; \
mv one2 one; \
COUNT=`expr $${COUNT} + 1`; \
SIZE=`expr $${SIZE} + $${SIZE}`; \
/bin/echo -n "."; \
done; \
echo " $${SIZE}"
@mv one $@
@/bin/echo -n "$@: Mark blocks:"
@OFFSET=524544; \
for block in 02 03 04 05 06 07 10 11 12 13 14 15; do \
/bin/echo -ne "\360\0$${block}\000\000\000" >header; \
dd if=header of=$@ bs=1 seek=$${OFFSET} conv=notrunc 2>/dev/null; \
/bin/echo -n " $${OFFSET}"; \
OFFSET=`expr $${OFFSET} + 131072`; \
done; \
echo ""
@/bin/echo -n "$@: Copy firmware \"$(FIRMWARE)\" to "; expr 16 \* 1024
@dd if=$(FIRMWARE) of=$@ bs=16 seek=1024 conv=notrunc 2>/dev/null
@/bin/echo -n "$@: Set copyright \"$(COPYRIGHT)\" at "; expr 16 \* 1024
@/bin/echo -n "$(COPYRIGHT)" >copyright
@dd if=copyright of=$@ bs=16 seek=1024 conv=notrunc 2>/dev/null
@rm -f one one2 header copyright

sram:
dd if=/dev/zero of=$@ bs=1024 count=512

s3c2410-sram:
dd if=/dev/zero of=$@ bs=1024 count=4
install: all $(TARGET).desktop $(TARGET).man
install -D -m 755 $(TARGET) "$(INSTALL_BINARY_DIR)/$(TARGET)"
install -D -m 644 $(BOOT49GP) "$(INSTALL_DATA_DIR)/$(BOOT49GP)"
install -D -m 644 $(BOOT50G) "$(INSTALL_DATA_DIR)/$(BOOT50G)"
install -D -m 644 $(IMAGE49GP) "$(INSTALL_DATA_DIR)/$(IMAGE49GP)"
install -D -m 644 $(IMAGE50G) "$(INSTALL_DATA_DIR)/$(IMAGE50G)"
install -D -m 644 $(TARGET).desktop "$(INSTALL_MENU_DIR)/$(TARGET).desktop"
install -D -m 644 $(TARGET).man "$(INSTALL_MAN_DIR)/$(TARGET).1"

$(TARGET).desktop: x49gp.desktop.in
perl -p -e "s!TARGET!$(TARGET)!" <x49gp.desktop.in >$@

$(TARGET).man: x49gp.man.in
perl -p -e "s!TARGET_ALLCAPS!$(TARGET_ALLCAPS)!;" -e "s!TARGET!$(TARGET)!" <x49gp.man.in >$@

sdcard:
ifeq ($(shell uname),Darwin)
Expand All @@ -238,9 +199,6 @@ else
/sbin/mkdosfs -v -C -S 512 -f 2 -F 16 -r 512 -R 2 -n "x49gp" $@ 65536
endif

config:
./newconfig

sim: dummy
$(MAKE) -C $@

Expand Down Expand Up @@ -285,8 +243,7 @@ clean: clean-libs

distclean: clean
rm -rf $(QEMU)
rm -f $(TARGET) flash-49g+ flash-50g flash-noboot sram s3c2410-sram
rm -f config
rm -f $(TARGET) $(TARGET).desktop $(TARGET).man $(TARGET).man

depend-and-build: depend
$(MAKE) -C . all
Expand All @@ -311,8 +268,7 @@ clean: clean-qemu

distclean: clean
$(MAKE) -C $(QEMU) -f Makefile-small distclean
rm -f $(TARGET) flash-49g+ flash-50g flash-noboot sram s3c2410-sram
rm -f config
rm -f $(TARGET) $(TARGET).desktop $(TARGET).man $(TARGET).man

depend-libs: $(QEMU)/config-host.h

Expand Down
63 changes: 0 additions & 63 deletions README

This file was deleted.

1 change: 0 additions & 1 deletion README.QEMU

This file was deleted.

11 changes: 0 additions & 11 deletions README.config

This file was deleted.

Loading

0 comments on commit c61f11c

Please sign in to comment.