Commit graph

83 commits

Author SHA1 Message Date
Lephe
6ebfe8484e
Revert "meta: build with -ffreestanding"
This reverts commit b0c4e6fd2f.

After investigation, this is related to builtin functions. Using
-fno-builtin is a less invasive way to solve the problem. However this
appears to be a bug [1]; in theory fat LTO objects should solve that. I
will handle this matter at the fxSDK level by adding -fno-builtin right
and experimenting with the bugfix in binutils 2.43.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114337
2024-08-07 10:13:47 +02:00
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
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
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
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
7ac2ae25f2
gdb: stdout/err redirect + support swbreak + optional bridge logs 2024-04-13 09:20:01 +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
2755596d59
meta: build with -g to allow add-in debugging 2024-03-31 14:14:52 +02:00
Lephe
faead4bc1d
Merge remote-tracking branch 'redoste/gdb' into dev (#27) 2024-03-25 08:05:48 +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
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
Lephe
18a7b9ae5b
display: add dcircle() and dellipse() rendering functions
For PythonExtra#2.
2024-01-04 12:00:58 +01:00
redoste
aa0ff7b10b
ubc: basic User Break Controller driver 2023-05-24 22:21:01 +02:00
redoste
0bea485f4b
gdb: first implementation with basic memory and register read support 2023-05-21 19:49:23 +02:00
Lephe
dcb876dfe0
bump version to 2.10.0 2023-04-02 00:10:13 +02:00
Lephe
3a2a194693
usb: unaligned reading (release candidate on features)
The only thing left on the bucket list is performance.
2023-03-26 11:36:40 +02:00
Lephe
af5c16a3d3
usb: massively improve writing logic
* Move logic around tracking transfers to asyncio.c.

* Add a "short buffer" holding 0-3 bytes between writes, so that the
  driver performs only 4-byte writes in the FIFO and a short write in
  the commit, if needed.
  - This is partially due to me thinking at some point that degrading
    writing size was impossible, but it might actually be possible by
    writing to FIFO/FIFO+2 or FIFO/FIFO+1/FIFO+2/FIFO+3.
  - In any case I think this new approach wins on performance.

* Get rid of unit_size since we now always use 4 bytes.

* Add a waiting function which is used in usb_close() (and once tested
  should be used in world switches too).

* Eliminate some of the special cases for the DCP, though not all (in
  particular I can't get the commit to rely on the BEMP interrupt yet,
  nor can I properly clear PID to NAK when unbinding).
2023-02-09 23:00:44 +01:00
Lephe
ac6b1c7d70
ld: generate linker scripts; add fxcg50_fastload.ld 2023-01-15 01:36:28 +01:00
Lephe
feb74a38ec
usb: hide USB_LOG() behind a compile-time debug option 2022-11-29 20:03:03 +01:00
Lephe
4df3d69d8c
render: add a window setting to restrict rendering
Mono text rendering is a bad hack and probably not that fast, but meh.
We can optimize it the day it becomes a bottleneck, if ever...
2022-11-19 17:19:28 +01:00
Lephe
74438f5da5
render: add a dgetpixel() function 2022-11-16 19:12:48 +01:00
Lephe
9924dc4684
fs: add rename() function on fx-CG 2022-08-22 15:25:14 +02:00
Lephe
4f9b141b79
bump version to 2.9.0 2022-08-21 20:12:34 +02:00
Lephe
126d1506ac
cmake: install in the fxSDK sysroot 2022-08-19 16:35:47 +02:00
Lephe
8c9c48a91e
bump version to 2.8.0 2022-05-16 20:13:13 +01:00
Lephe
b942bc5d19
clock: add overclock support on fx-CG 10/20/50 2022-05-15 19:20:14 +01:00
Lephe
c2ff07427b
image: add image_linear_alloc() 2022-05-15 13:45:59 +01:00
Lephe
09c13676d3
image: arbitrary linear transforms 2022-05-15 12:59:28 +01:00
Lephe
780acb3fc9
image: arbitrary linear transforms [WIP] 2022-05-14 22:32:59 +01:00
Lephe
818f950fff
image: flips, including in-place 2022-05-14 20:27:16 +01:00
Lephe
9468a8d725
image: clean up palette semantics, and conversion 2022-05-14 15:36:07 +01:00
Lephe
fc6f7d3051
image: remove alpha field of images 2022-05-14 12:54:59 +01:00
Lephe
5a69e44078
image: new image format and base for the image library 2022-05-13 23:31:03 +01:00
Lephe
ede19fc878
render-cg: restore bopti method on P4 and defined p4_clearbg_alt 2022-05-06 16:26:44 +01:00
Lephe
a4df076214
render-cg: replace dimage and dsubimage with new renderer 2022-05-04 20:53:56 +01:00
Lephe
7a3604ccbb
render-cg: allocate VRAM in the heap; default to double buffering
* Create a heap arena over the OS stack, large enough to hold two VRAMs
  as was previously done, unless GINT_NO_OS_STACK is set at compile
  time. (This replaces GINT_USER_VRAM.)

* Allocate a single VRAM in the heap at startup.

* Use double buffering by default as triple buffering is almost entirely
  useless. dudpate() waits if both VRAMs are identical to prevent
  corruption, but this can be bypassed with R61524 functions as usual.
  This adds about 180 kB of heap data to any add-in using default
  settings.
2022-05-04 20:08:52 +01:00
Lephe
f219e5c882
render-cg: add new image rendering functions with dynamic effects 2022-05-04 19:08:54 +01:00
Lephe
e57efb5e37
keysc: simpler keyboard device with more consistent repeats
* Stop trying to be smart and generate repeats on the fly; this breaks
  time consistency. Also if repeats are not handled in time this causes
  infinite loops.
* Move rarely-used functions to external files, simplify stuff, get rid
  of internal driver events; saves ~1 kB per add-in overall.
2022-04-23 13:34:41 +01:00
Lephe
2bf5dd93f4
bump version to 2.7.1 2022-03-19 19:27:53 +00:00
Lephe
9b02f5f1db
bump version to 2.7.0 2021-12-31 10:46:46 +01:00
Lephe
b549fd68ba
fs: stat(), proper unlink(), rmdir() 2021-12-30 18:17:13 +01:00
Lephe
9cae0040b5
fs: folder support, part 1 (mkdir/rmdir and the opendir(3) family) 2021-12-21 19:01:00 +01:00
Lephe
6903bd58d5
fs: cast BFile support into generic file descriptors
This paves the way for standard streams, USB streams, and some more.
2021-12-13 18:38:47 +01:00
Lephe
8635880bbb
fs: basic filesystem support over BFile 2021-12-11 16:38:28 +01:00
Lephe
2d0e18f2d8
bump version to 2.6.0 2021-08-29 11:53:40 +02:00
Lephe
d3a2cf07a0
usb: add video capture through the fxlink protocol 2021-08-11 01:43:26 +02:00
Lephe
5bd04a9613
cpu, dma: add interrupt-cancellable sleep (perfect async sleep) 2021-06-17 14:32:08 +02:00