Commit graph

558 commits

Author SHA1 Message Date
Lephe
85e50658ea
libc: provide the fxlibc HAL
See 8cedf41 in fxlibc for rationale.
2024-08-06 19:01:43 +02:00
Lephe
b0c4e6fd2f
meta: build with -ffreestanding
As of now (fxSDK 2.11), this flag is set globally by the fxSDK, so this
change doesn't have an immediate effect. However, I've been
experimenting with removing -ffreestanding at the global level to allow
applications to build with the hosted C++ library (which isn't fully
supported by has many supported features, like containers, that aren't
available in free-standing mode).

Without -ffreestanding, LTO makes weird decisions and ends up pruning
way too many symbols from libraries, leading to undefined references for
symbols provided by the standard library. Here is a minimal example.

---
% cat abort.c
void abort(void)
{
    __builtin_unreachable();
}
% cat main.c
extern void abort(void);
int start(void)
{
    abort();
    return 0;
}
% cat sh-min.x
ENTRY(_start)
OUTPUT_FORMAT(elf32-sh)
SECTIONS {
	. = 0x1000;
	.text : { *(.text) }
	.data : { *(.data) }
	.bss : { *(.bss) }
}
% sh-elf-gcc -flto -nostdlib -ffreestanding -c abort.c -o abort.o
% sh-elf-gcc-ar rcs abort.a abort.o
% sh-elf-gcc -flto -nostdlib -c main.c -o main.o
% sh-elf-gcc -flto -nostdlib -save-temps main.o -o main -T ./sh-min.x abort.a -lgcc
ld: ./main.ltrans0.ltrans.o: in function `_start':
<artificial>:(.text+0xc): undefined reference to `_abort'
---

To solve the bug in this example, add -ffreestanding when making main.o.

I haven't been able to sufficiently dump/introspect intermediate files
to understand what's happening yet. It's also unclear whether the fix is
clean since LTO normally requires all files to be built with the same
settings, so adding -ffreestanding to gint but not the add-in seems
suspicious. There is, however, an inherent incompatibility in the
conjunction of (1) building kernels with -ffreestanding, (2) building
add-ins that use the C++ library thus require -fhosted, and (3) only
linking objects files built with the same options.
2024-08-06 11:52:41 +02:00
Lephe
ae3250edd0
fs readdir: fix handling of BFile_Type_MainMem entries
These are g*m files, not the @MainMem folder.
2024-08-04 07:55:14 +02:00
Lephe
a45135776a
fs readdir: recognize a few more bfile types 2024-07-27 21:49:01 +02:00
Lephenixnoir
4173bf1f78
exch, inth: save more data in context structure, and simplify entries 2024-07-15 20:57:26 +02:00
Lephenixnoir
f0bca5183f
cpg: fix typo in #30 2024-07-15 18:35:22 +02:00
Lephenixnoir
063dab777d
meta: update progress in TODO 2024-07-13 21:05:09 +02:00
Lephenixnoir
faef1aa325 Merge pull request 'corrected overclock parameter F5 as per Sentaro21 recommendations for weak fxCG50 machines' (#30) from Slyvtt/gint:dev into dev
Reviewed-on: https://git.planet-casio.com/Lephenixnoir/gint/pulls/30
2024-07-13 16:14:13 +02:00
Sylvain PILLOT
51e3945094 corrected overclock parameter F5 as per Sentaro21 recommendations for leak fxCG50 machines 2024-07-13 10:26:37 +02:00
Lephenixnoir
395250b5a9
exch: add trapa #31 handler 2024-07-13 10:11:26 +02:00
Lephe
badbd0fd2b
bump version to 2.11.0 2024-07-06 10:21:11 +02:00
Lephe
52c17ccb05
render-fx: add dvram_quit on fx builds 2024-07-04 21:23:45 +02:00
Lephe
88eb5413a6
gint: remove the need to track filename offset in stage-2 load
By patching the ELF we insert the filename at a time where the file
format itself already tracks it (through the symbol .stage2_filename).
2024-06-05 10:49:13 +02:00
Lephe
da05e89b1c
gint: disable restart on fx-CP
There is no return-to-menu so enabling it would just loop.
2024-06-04 17:58:16 +02:00
Lephe
f70f1d9ae3
keysc: make the fx-CP Clear key EXIT instead of AC/ON
It's much more useful for compatibility with keyboard apps
2024-06-04 17:57:38 +02:00
Lephe
371e593f1d
gint: get 104 kB of end RAM instead of 64 kB with HH2 2024-06-04 17:57:09 +02:00
Lephe
58eb5d92d7
gint: stage-2 loads for HH2 2024-06-04 11:28:23 +02:00
Lephe
1fc7290b09
gint: setup to prepare HH2 stage-2 loads 2024-06-02 22:01:29 +02:00
Lephe
84a4dd7ca9
gint: compressed VRAM save on fx-CP
This frees the OS' backup VRAM, which is a 337920-byte buffer sitting
at a fixed address, for loading code.
2024-06-01 14:41:09 +02:00
Lephe
335326692f
meta: add LTO support and enable it by default
* Set -flto
* Use gcc-ar to build the archive so the LTO plugin is loaded and LTO
  sections aren't stripped off the object files
* Slightly conservative KEEP()s in the linker script (not required but
  I'm paranoid)
* Make the drivers __attribute__((externall_visible)) so they are
  generated by the link-time back-end and not left in the archive
* Remove the unused isappli/optnum parameters of main, which have been
  unused for years, are irrelevant on fx-CG and lead to a link-time
  warning with LTO. I'll add APIs to access them later.
2024-05-26 18:16:31 +02:00
Lephe
ea5f21d1dc
cmake: make the linker script a link dependency of projects
This way when we update the linker script in the upcoming LTO support
commit, it will be used automatically without a full rebuild.
2024-05-26 18:13:12 +02:00
Lephe
4a2b60b785
keysc: add support for the CP-400 key layout 2024-05-25 18:01:15 +02:00
Lephe
e3105701d9
cpu: also save rN_bank registers at startup/exit
These are at least used on the CP to hold OS-related interrupt handler
pointers (to handling routines).
2024-05-25 17:59:10 +02:00
Lephe
5b16888d9d
gint: provide short type definitions (i8, u8, etc.) 2024-05-25 17:56:28 +02:00
Lephe
5626713f40
render: add NULL alloc check to dpoly() 2024-04-26 18:56:01 +02:00
Lephe
789ba7caa5
gint: basic support for fx-CP 400 programs with HollyHock 2 loading
Features will come in slowly while I restructure for gint 3. With this
third big target for gint, the legacy aspects of gint 2's structure and
API are getting felt, so a major revision will be in order.

See the TODO file at this commit for info on what works and not.
2024-04-16 15:53:10 +02:00
Lephe
5c3dc3220a
intc: add definition for SCIF interrupt 2024-04-14 18:21:14 +02:00
Lephe
7ac2ae25f2
gdb: stdout/err redirect + support swbreak + optional bridge logs 2024-04-13 09:20:01 +02:00
Lephe
d065a17063
gdb: add icons on mono (bypassing video intf for now) 2024-04-10 08:29:28 +02:00
Lephe
0afd05848a
gdb, video, r61524: gdb visual feedback + start video intf on CG
- Define a draft of the video interface
- Implement that dragt for CG for a single mode
  * Includes stub of brightness setting from disassembling 3.60
- Use the video interface to show visual feedback on GDB on CG

Using the video interface avoids directly linking into a driver, which
will serve modularity in gint 3.
2024-04-09 08:57:46 +02:00
Lephe
b4c0fc7cea
gdb: support 'C' packet for resuming with signals
It's not super useful as a feature but it means that a naive "continue"
after e.g. a segfault will kill the program and not confusingly go into
an infinite loop.
2024-04-01 00:50:07 +02:00
Lephe
2755596d59
meta: build with -g to allow add-in debugging 2024-03-31 14:14:52 +02:00
Lephe
ab528b27a8
gdb: provide more accurate stop reasons 2024-03-30 21:42:34 +01:00
Lephe
d9414bb6f2
gdb: allow gdb stub to automatically start when a crash occurs
The user can still gdb_start() + gdb_main(NULL) manually, which allows
e.g. early setup of breakpoints. The start_on_except mechanism is the
lazier method where we just run the add-in normally and start fxsdk gdb
on the PC *after* a crash occurs.
2024-03-30 21:41:35 +01:00
Lephe
4623d790cc
ubc: slight cleanup
It is guaranteed by the driver model that drivers are powered on when
gint is active. Sharing the driver isn't too useful because we can't
remote debug in the OS world anyway, there's no USB driver there.
2024-03-30 21:41:08 +01:00
Lephe
faead4bc1d
Merge remote-tracking branch 'redoste/gdb' into dev (#27) 2024-03-25 08:05:48 +01:00
Lephe
f8208d093b
meta: add note in README about build-fxg3a
This README is seriously outdated by now...
2024-03-24 11:17:10 +01:00
Lephe
946d4d9a6f
gray, r61524: gray engine for r61524
gray/engine.c looks terrible by now and it will have to be cleaned up in
the future, with the whole video modes abstraction.
2024-03-24 08:53:12 +01:00
Lephe
3a42b5d386
gint: switch away from FX9860G/FXCG50 macros
Not changing much for now, just distilling them into hardware/OS/render
macros. Later on the rendering stuff will become more dynamic and down
the line I want to unify the APIs more.
2024-03-24 08:28:22 +01:00
Lephe
ee109e4977
r61524: improve mono emulation with centering and a border
This reaches 7.5 ms so nothing to add there.
2024-03-24 08:28:12 +01:00
Lephe
5548bf68ab
render: add R61524 backend to render-fx for build-fxg3a target 2024-03-23 12:09:53 +01:00
Lephe
28bea2e1ce
gint: switch from file filters to config macros + basic fxg3a target
Nothing interesting in this commit, just moving files around, making
sure every target compiles every file, and controlling with macros
instead.

Basic support for fxg3a target in CMakeLists.txt, cmake/FindGint.cmake,
giteapc.make and include/gint/config.h.in. The rest is forgettable.
2024-03-23 10:02:51 +01:00
Lephe
b2b1f00d04
fs: take const descriptor in open_generic() 2024-03-19 19:03:33 +01:00
Lephe
5ff6a518f6
gint: memory micro-optimizations 2024-03-19 19:03:17 +01:00
Lephe
bc74586a2c
render: parametrize existence of dmode in config.h
This is the first of many steps designed to reduce gint's reliance on
the FX9860G and FXCG50 macros by describing the compile target more
symbolically. The goal is to allow both for g3a compilation of fx-API
code and for a potential CP port.
2024-03-19 18:37:13 +01:00
Lephenixnoir
e0ac25fbb0
render: improve implementation of dpoly()
* Honor dwindow settings immediately (avoids useless dline() calls)
* Bound to ymin/ymax instead of doing many useless cut computations
* Remove the need for floating-point operations and division
2024-03-02 23:16:22 +00:00
Sylvain PILLOT
b802e8edef
added dpoly() rendering method 2024-03-01 17:37:35 +00:00
Lephe
d8005b5d49
kmalloc: support for PRAM0 arena
PRAM0 is mostly standard memory but it can only be read from and written
to with 32-bit memory accesses.
2024-02-04 22:10:25 +01:00
Lephe
e50769c824
kmalloc: add kmalloc_remove_arena() function 2024-02-04 22:10:01 +01:00
Lephe
542b4f0a81
fs: fix fugue_dir_explore() error not propagating to open() 2024-02-04 18:50:37 +01:00