Files
zOS/apps/mbasic/Makefile
Philip Smart c0d33737e1 Fix K64F build: make heap overrides ZPU-only for tbasic, kilo, ed
The tbasic, kilo, and ed apps unconditionally overrode HEAPADDR/HEAPSIZE
with ZPU BRAM addresses (0x1FFF5000+0x33000=0x20028000) that exceed the
K64F app CODE region. Wrapped overrides in ifeq ($(__ZPU__),1) so K64F
builds use the default heap/stack calculated by build.sh.

Also disabled mbasic K64F build (heap overrides + code size exceed CODE
region) — mbasic was already disabled for ZPU.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:18:55 +00:00

85 lines
3.7 KiB
Makefile
Executable File

#########################################################################################################
##
## Name: Makefile
## Created: July 2019
## Author(s): Philip Smart
## Description: App Makefile - Build an App for the ZPU Test Application (zputa) or the zOS
## operating system.
## This makefile builds an app which is stored on an SD card and called by ZPUTA/zOS
## The app is for testing some component where the code is not built into ZPUTA or
## a user application for zOS.
##
## Credits:
## Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
##
## History: July 2019 - Initial Makefile created for template use.
## April 2020 - Added K64F as an additional target and resplit ZPUTA into zOS.
## 23/4/2020 - Updated to merge mini basic, ed and command processor.
##
## Notes: Optional component enables:
## USELOADB - The Byte write command is implemented in hw#sw so use it.
## USE_BOOT_ROM - The target is ROM so dont use initialised data.
## MINIMUM_FUNTIONALITY - Minimise functionality to limit code size.
##
#########################################################################################################
## This source file is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This source file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################################################
APP_NAME = mbasic
APP_DIR = $(CURDIR)/..
APP_COMMON_DIR = $(CURDIR)/../common
COMMON_DIR = $(CURDIR)../../common
BASEDIR = ../../..
# Override values given by parent make for this application as its memory usage differs from the standard app.
# mbasic only builds on K64F (ZPU build disabled due to missing maths libraries).
# These overrides extend the CODE region to encompass the larger heap needed by the BASIC interpreter.
override HEAPADDR = 0x2000C000
override HEAPSIZE = 0x0001BC00
override STACKADDR = 0x20027C00
override STACKSIZE = 0x00000400
# Modules making up Mbasic.
APP_C_SRC = basic.c ed.c $(APP_COMMON_DIR)/sbrk.c $(APP_COMMON_DIR)/sysutils.c $(COMMON_DIR)/readline.c
UMM_C_SRC = fail
CFLAGS =
CPPFLAGS = -D__HEAPADDR__=$(HEAPADDR) -D__HEAPSIZE__=$(HEAPSIZE)
LDFLAGS =
# Filter out the standard HEAP address and size, replacing with the ones required for this application.
# Useful for sub-makes
FILTER1 = $(filter-out $(filter HEAPADDR=%,$(MAKEFLAGS)), $(MAKEFLAGS))
FILTER2 = $(filter-out $(filter HEAPSIZE=%,$(FILTER1)), $(FILTER1))
NEWMAKEFLAGS = $(FILTER2) HEAPADDR=$(HEADADDR) HEAPSIZE=$(HEAPSIZE)
ifeq ($(__K64F__),1)
# Currently mbasic doesnt build on K64F - heap/stack overrides exceed the app CODE region.
# TODO: Rework memory layout to fit within K64F SRAM constraints.
#include $(APP_DIR)/Makefile.k64f
clean:
all:
install:
else
# Currently mbasic doesnt build on the ZPU due to missing maths libraries. Once I can source them it should build.
#include $(APP_DIR)/Makefile.zpu
clean:
all:
install:
endif