Commit graph

503 commits

Author SHA1 Message Date
Solomon Peachy
0f8f05db29 build: Enforce -Wundef on all targets.
Simulators (and some hosted targets) no longer get a free pass!

This commit includes general fixes for simulator builds, but it
will undoubtedly result in many more warnings that need to be properly
fixed.

Change-Id: I6bb9d3fc4a29ccfe40366c438e058b5dfff0ddc3
2025-10-12 16:12:56 -04:00
Solomon Peachy
6150e556fe unicode: Turn on 32-bit unicode for targets with >2MB RAM
Change-Id: I199dc928fc9a88fa4bff7bdb3dc03bb212612f6f
2025-09-16 20:56:16 -04:00
Solomon Peachy
a2c10f6189 unicode: Support characters beyond the first unicode plane
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * font manipulation, caching, rendering, and generation
 * on-screen keyboard
 * FAT filesystem (parsing and generating utf16 LFNs)
 * WIN32 simulator platform code

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Appears to work on:

  * hosted linux, native, linux simulator in both 16/32-bit modes.

Needs testing on:

  * windows and macos simulator (16bit+32bit)

Change-Id: Iba111b27d2433019b6bff937cf1ebd2c4353a0e8
2025-09-12 09:24:30 -04:00
Solomon Peachy
84504c7471 Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b.
2025-08-20 16:09:49 -04:00
Solomon Peachy
d05c59f35b internals: Support characters beyond the first unicode plane (WIP)
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * on-screen keyboard
 * font manipulation, caching, rendering, and generation
 * VFAT code parses and generates utf16 dirents
 * WIN32 simulator reads and writes utf16 filenames

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Known bugs:

  * Native players in 32-bit unicode mode generate mangled filename
    entries if they include UTF16 surrogate codepoints.  Root cause
    is unclear, and may reside in core dircache code.

Needs testing on:

 * windows simulator (16bit+32bit)

Change-Id: I193a00fe2a11a4181ddc82df2d71be52bf00b6e6
2025-08-20 16:08:43 -04:00
Hairo R. Carela
48392bab94 New port: Anbernic RG Nano
A bit of context, this device is a clone of the FunKey-S with a different form factor, hardware is mostly identical, the relevant difference is it has audio out (via usb-c, adapter to 3.5mm is included), this is the reason why the FunKey-SDK is needed for bulding.

This port is based on the old SDL 1.2 code because the device doesn't have SDL2 support. Alongside what was supported in the SDL 1.2 builds this port supports battery level, charging status and backlight control.

Change-Id: I7fcb85be62748644b667c0efebabf59d6e9c5ade
2025-07-29 21:01:53 -04:00
Vencislav Atanasov
a901b530e0 Require HAVE_LCD_SLEEP when HAVE_LCD_SLEEP_SETTING is defined
Change-Id: I5429c538b8c46ab857100f3a290c4241c8991038
2025-07-23 20:46:41 +02:00
Solomon Peachy
82f3d0c18f WIP hosted port to the Surfans F28
* Only bootloader builds
 * Plugins disabled
 * No keymaps to anything else
 * No simulator
 * Touchscreen not wired up yet
 * Audio still untested

Bugs:

 * rotary encoder does nothing in bootloader
   (might be bootloader bug, might be something else)

Other stuff pulled in:

 * Unify all of the (identical!) hibyos makefiles
 * Rename the "bootloader" to more generic name

Change-Id: I6d8a3b58de726db8e89cf193c90960a070a575c2
2025-05-04 18:34:22 -04:00
Aidan MacDonald
83950bf233 New WIP port: Echo R1
The Echo R1 is a new open-hardware music player design, based
on the STM32H743 microcontroller. Schematics and hardware
documentation for it can be found here:

- https://github.com/amachronic/echoplayer

This is an incomplete port. The bootloader can be loaded using
OpenOCD and it can draw to the LCD using SPI. SDRAM is working
but hasn't been extensively tested.

Change-Id: Ifd2bee15c49868fbc989683d3ca14dce48bf3e18
2025-04-22 20:08:08 -04:00
Solomon Peachy
0d8f99e78c Fix red in 180753ce0a
Change-Id: Ie324d923a322bb8fbf429498ad653d4e83b6f97d
2025-04-21 16:59:10 -04:00
Solomon Peachy
180753ce0a misc: Correct various -Wunterminated-string-initialization warnings
-Wunterminates-string-initialization will complain if we try to shove
a "string" into a fixed array that is too small.  Sometimes this is
intentional; when you are merely using "string" as a standin for
"non-terminated sequence of bytes".  In these cases we need to mark
the "string" as "not actually a string" with an attribute.  Applies to
GCC >=8, but this warning isn't pulled in by -Wextra until GCC >= 15.

Change-Id: Ib94410a22f4587940b16cf03d539fbadc3373686
2025-04-21 16:39:00 -04:00
Aidan MacDonald
1aa9f26b02 arm: workaround to build Cortex-M7 targets with GCC 4.9
Cortex-M7 support was added in GCC 5, while GCC 4.9 only
supports the M4. The instruction set is almost identical
between both processors; the only difference is that the
M7 supports double-precision floating point and the M4
doesn't.

Since Rockbox currently doesn't use the FPU, building M7
targets as M4 works fine.

Change-Id: I5880d6e81a85fa9b3e16e08d57e7955b4493df0b
2025-04-19 13:16:36 -04:00
Aidan MacDonald
6ea328f0f1 arm: add div0 handler for 64-bit division on ARMv7-M
Even though ARMv7-M has a hardware divider, 64-bit division is
handled in software and needs a div0 handler. The libgcc routines
call __aeabi_{i,l}div0 so we alias those to __div0.

Change-Id: I5152c43d39e25e03f31404753f13978a614aca06
2025-04-19 09:43:40 -04:00
Vencislav Atanasov
545506c923 New port: iPod Nano 4G
Currently, only the development bootloader can be built successfully.

This is a part of the large iPod Nano 3G and iPod Nano 4G support patch.

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: I74ea0da999ddb1d8ce5d0f5434141b3f0b5f7448
2025-04-18 20:40:49 -04:00
Vencislav Atanasov
d6cd237f80 New port: iPod Nano 3G
Currently, only a bootloader can be built successfully. The development bootloader is functional, it enables further progress on the port.

This is a part of the large iPod Nano 3G and iPod Nano 4G support patch.

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: Idf85e42334b0e0ae36f9ed273e2940d5d7736e34
2025-04-18 20:10:29 -04:00
Aidan MacDonald
639b587fc7 arm: add support for processors with hardware division
ARMv7-M has hardware division, so it doesn't require __div0
or any support functions for 32-bit division.

Change-Id: I840683a1a77d737f378899ca4bcf858216b81014
2025-04-18 09:22:48 -04:00
Aidan MacDonald
7e8a818d95 arm: add ARM architecture profile detection
Add some logic to detect classic and M-profile cores, and make
this info available to the build system. All existing targets
are classic profile.

Change-Id: I07bfcd418bcaa6297b9bbf889fc189f167147428
2025-04-18 09:22:48 -04:00
William Wilgus
4f3bbeaffc Remove BATTERY_TYPES
Change-Id: I4fa03a10d0032fd6f92722bbe1d4b7eec0b95cb4
2025-03-11 02:26:38 -04:00
Dana Conrad
96463d855f erosqnative: hw4 units prefer egauge battery percentage
Use AXP2101's egauge battery percent level if available (hw4 units).
If not available (_battery_level() will return -1 on hw1-hw3 units),
fall back to voltage battery level.

Also fix logic in axp2101_battery_status()

Change-Id: Ic300418532dae6f7772fff8bf5e2b32516f3b973
2025-01-19 17:30:21 -05:00
William Wilgus
02c256565f [FixRed] Reove HAVE_PITCHCONTROL from bootloaders, fix warble
Change-Id: I85a3580bd5fac881ca36efc260791d03f0b8c83a
2025-01-19 01:20:58 -05:00
Vencislav Atanasov
1c7fddad5b Add the remaining iPod Nano SoCs to config
Currently only S5L8701 (Nano 2G) and S5L8702 (Classic/6G, Nano 3G) are defined. This change adds the remaining to CONFIG_CPU, as a preparation for porting to these platforms. It also defines the RTC types for Nano 3G and Nano 4G.

New CONFIG_CPU options:
S5L8720 - iPod Nano 4G
S5L8730 - iPod Nano 5G
S5L8723 - iPod Nano 6G
S5L8760 - iPod Nano 7G

Change-Id: I4e9e00163c0d0d5a5303f9eee428f9be47a48359
2024-11-21 20:03:32 -05:00
Vencislav Atanasov
f040c4c9ec Rename CPU_S5L870X to CPU_S5L87XX
This is a preparation to introduce support for the following SoC models: S5L8720 (iPod Nano 4G, iPod Touch 2G), S5L8730 (iPod Nano 5G), S5L8723 (iPod Nano 6G) and S5L8740 (iPod Nano 7G)

The whole family consists of SoCs which are similar, running ARMv6 and Thumb2 instructions, but some peripherals are located at a different address.

No functional change is to be expected so far.

Change-Id: If1f7669c49cf110ccc52c5234cc42ffd6f2b4e80
2024-11-20 10:58:32 -05:00
Solomon Peachy
c61ad40812 storage: Wrap runtime variable sector size with MAX_VARIABLE_LOG_SECTOR
When enabled this allows 512n and 4Kn drives to be used with a single build.
(So far all ATA SSDs use 512 byte logical sectors)

Change-Id: I902d2318ca8abb581699c0bca68d6e3ec227d064
2024-11-09 16:34:06 -05:00
Solomon Peachy
67ad6589fb Fix additional red introduced in 04dc052a96
Change-Id: Ie553673c5899d8399fa1cb1d7029f0d48075a420
2024-11-02 14:58:49 -04:00
Solomon Peachy
04dc052a96 Fix (most of) the red in a8c52b1bfb
HAVE_STORAGE_INFO needs to be defined for all non-sim/hostfs targets

Change-Id: Id0d6f88306776cfc286fc0d852b77b70ba389efc
2024-11-02 14:46:23 -04:00
Solomon Peachy
395311f7a1 simulator: Make sure we define the right stuff for sigaltstack()
We got some of this stuff through SDL1 implicitly.

Change-Id: I349be640ac15f79048d860bb58bae93a74a0e1ec
2024-09-21 19:08:32 -04:00
Solomon Peachy
a7fba55fcf warble: Fix build
Change-Id: I52028c2244a9951fc4a04f82cf1c85557539a50b
2024-09-21 19:08:31 -04:00
Dana Conrad
cd91c238de Bootloaders: Include HAVE_MULTIVOLUME if BOOT_REDIR also present
We need HAVE_MULTIVOLUME in bootloaders for redirect
functionality to work.

Change-Id: I50dbbb179bd012696e592ca843809fcc5fb78994
2024-08-21 18:31:28 -04:00
Solomon Peachy
fe5bee50be Multivolume: Hosted targets are also limited to just one volume per "drive"
(It would be interesting to try and work around this but it would have to
 be done on a per-target/platform basis)

Change-Id: I7a27199082998420fea3c6abbbf5f3c526ccaec4
2024-07-20 08:46:21 -04:00
Solomon Peachy
82cf845625 simulator supports only one logical volume per drive
Change-Id: I8f32743c98771ca38c04d42bf6b2dd4768cfedad
2024-07-19 22:04:00 -04:00
Solomon Peachy
1528b44349 More red fixes
Change-Id: If22cdb286edac47b08b158bee6910ba7a539b041
2024-07-07 14:47:07 -04:00
Solomon Peachy
dc364e44ef Disable HAVE_MULTIVOLUME for bootloaders
Multivolume support is only necessary if mounting multiple volumes
simultaneously, which the bootloader won't do.

Change-Id: I725061dd2aa47abe7652b0d27258dd3af821c913
2024-07-07 12:43:10 -04:00
Solomon Peachy
181fe7530a Fix most of the (extensive) red in ea80d1cc9ca
Change-Id: Ie494df80caa222423a52977031920d54bd058c3c
2024-07-07 12:05:18 -04:00
Solomon Peachy
ea80d1cc9c config: Change default HAVE_MULTIVOLUME settings
* HAVE_MULTIDRIVE implies HAVE_MULTIVOLUME as the latter is always
   removeable storage
 * SD storage implies MULTIVOLUME
 * ATA storage (with HAVE_LBA48) implies MULTIVOLUME
 * Replace HAVE_MULTIDRIVE && NUM_DRIVES == 1 with HAVE_MULTIVOLUME

Since SD and ATA can exceed 2TB, we need multiple volumes to fully
utilize available storage with FAT32.

In practice I believe this only affects the ipod devices.

Change-Id: Ia597770948b0e2b47630f7264ad34f225a33a640
2024-07-07 11:35:04 -04:00
Solomon Peachy
8b8c0c7c2a checkwps: Validate translated strings (%Sx)
In verbose mode it will log valid the strings found, otherwise it will
only complain when we encounter a missing string.

Unfortunately a missing string is not inherently a problem, due to
conditional expressions.  So all we can do is complain in checkwps
or if wps debugging is turned on.

Meanwhile, this is the first step in actually enumerating the translated
strings used by themes.

Change-Id: Ia93b333085e825d5b085c4d372ad8e13aa3e3ba1
2024-05-24 21:37:54 -04:00
Solomon Peachy
8c86fb6da0 arm: Use -masm-syntax-unified when compiling with gcc8 or newer
Annoyingly, this makes all of the '.S' files we compile get treated as
divided syntax, so we need to make the syntax in them explicit.

Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf
2024-05-08 21:45:42 -04:00
Aidan MacDonald
7dc8d754a2 Disable legacy codepage handling in bootloaders
Turn off legacy codepage handling in the filesystem code for
bootloaders, and support ISO-8859-1 (Latin-1) only.

This only affects DOS 8.3 filename parsing when FAT32 long
names are unavailable; long names are Unicode and can always
be decoded properly regardless of this setting.

In reality, bootloaders never supported codepages other than
Latin-1 in the first place. They did contain the code to load
codepages from disk, but had no way to actually change the
codepage away from Latin-1.

Compiling out this useless codepage handling code frees up
precious space for very size-constrained bootloaders like the
Sansa e200v2.

Change-Id: I26b049dd648fed4a0cc61fa938faa84e9816ab7d
2024-03-31 11:07:08 -04:00
roman.artiukhin
ed27dac432 Fix CODEC_AAC_SBR_DEC check with undefined CONFIG_CPU
Define CONFIG_CPU if not defined

This fix makes sure that  AAC-LC decoding is used both on device and simulator.
It's important for testing purposes as proper AAC-LC decoding requires changes both in decoder and in metadata handling.

Fixup for 4cd65b9d9.

Change-Id: Idef88825458761fffa3f5c5f4f221b555c509d89
2024-01-02 10:05:17 -05:00
Solomon Peachy
161c861153 Fix red in 4cd65b9d9
Change-Id: Ic3f136f5c88c46da68b78bc21ddefdf9fdbf2745
2023-12-31 21:30:18 -05:00
roman.artiukhin
4cd65b9d97 Codecs: mp4: Disable SBR decoding for PP5002 - PP5022 platforms
Includes ipod video (5G) and earlier models, sansa c200 and others players not capable to decode AAC-HE.

Allows to play backward compatible files as AAC-LC.

Change-Id: Ic9f5c0f255d9a4308c3414d402f8f27f4328ca94
2023-12-31 20:44:15 -05:00
Aidan MacDonald
58b2e45782 Fix unified syntax in ARM inline assembly
GCC 4.9 always emits assembly with divided syntax. Setting unified
syntax in inline assembly causes the assembler to complain about
GCC's generated code, because the directive extends past the scope
of the inline asm. Fix this by setting divided mode at the end of
the inline assembly block.

The assembler directives are hidden behind macros because later
versions of GCC won't need this workaround: they can be told to
use the unified syntax with -masm-syntax-unified.

Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8
2023-03-23 18:16:33 +00:00
Chris Chua
86429dbf1e Using ARM Unified Assembler Language
Change-Id: Iae32a8ba8eff6087330e458fafc912a12fee4509
2023-03-23 13:28:22 -04:00
Aidan MacDonald
5b27e2255a Add perceptual volume adjustment
The perceived loudness change of a change in volume depends
on the listening volume: at high volumes a 1 dB increment is
noticeable, but at low volumes a larger increment is needed
to get a comparable change in loudness.

Perceptual volume adjustment accounts for this fact, and
divides the hardware volume range into a number of steps.
Each step changes the dB volume by a variable amount, with
most of the steps concentrated at higher volumes. This
makes it possible to sweep over the entire hardware volume
range quickly, without losing the ability to finely adjust
the volume at normal listening levels.

Use "Volume Adjustment Mode" in the system settings menu
to select perceptual volume mode. The number of steps used
is controlled by "Number of Volume Steps". (Number of steps
has no effect in direct adjustment mode.)

It's still possible to set a specific dB volume level from
the sound settings menu when perceptual volume is enabled,
and perceptual volume does not affect the volume displayed
by themes.

Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
2023-01-22 21:19:57 +00:00
Aidan MacDonald
92565e9246 buflib: Add malloc-backed buflib
This is intended for improving the effectiveness of tools like
ASAN when debugging memory errors in the sim. It's not meant to
be a serious allocator for hosted targets.

Enable it by changing the buflib backend in config.h.

Change-Id: I0cf23cefa47ee35dede7b49e0e5b72dac60e8d3e
2023-01-15 10:04:13 +00:00
Aidan MacDonald
f995c26de9 buflib: Add CONFIG_BUFLIB_BACKEND for selecting a buflib backend
Defaults to the normal "mempool" backend, which is currently the
only implementation.

Change-Id: I56d034a6e0f5edc90c39526d1551945eec6ca336
2023-01-15 10:04:13 +00:00
Solomon Peachy
641e91aa2f jz47xx: Add support for INIT region
Change-Id: I100cd661e9b1225167463542800c6aafbc3c17b3
2023-01-13 16:14:42 -05:00
Aidan MacDonald
a980d5f869 x1000: Enable support for INIT_ATTR
Enable INIT_ATTR support in config.h. Load init code to the
codec buffer, following the convention used by other targets
that support INIT_ATTR.

Change-Id: I8935fbaa100f0013bb328d71c4a49ec2ffafd003
2022-12-31 08:10:41 -05:00
Aidan MacDonald
f373c97c90 Define LCD_STRIDEFORMAT unconditionally
Instead of putting "#ifdef LCD_STRIDEFORMAT" at every usage of the
macro it's simpler to have config.h define LCD_STRIDEFORMAT to the
default of horizontal stride when the target leaves it unspecified.

Change-Id: Ib187012aad65ac678dbd837b1464a83bad722411
2022-09-30 10:42:49 +01:00
Solomon Peachy
9ed36ec22f FS#13361: Fix some compilation under MacOS (Michael Landherr)
Change-Id: Id7e0576e355a1d71493fb7b277fd92f38b7edab4
2022-09-27 10:00:03 -04:00
Aidan MacDonald
464889ecee Fix red in e75a3fb8
Change-Id: I2e98f68d03df757688b6c556b69d934c12f40a7c
2022-09-25 12:23:40 +01:00