Commit graph

680 commits

Author SHA1 Message Date
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
Vencislav Atanasov
620a190baf iPod S5L87xx bootloader: Enable LCD sleep/awake test depending on target config, not on model
Change-Id: I7a3d86814e5f5b1c84ef73636f2094514aaf0120
2025-07-22 10:47:37 -04:00
Vencislav Atanasov
8d5f7baefe iPod S5L87xx bootloader: Add code for printing the bootloader hash
Change-Id: I6921ef894e328e462ea3ca77266a1a30b7a75972
2025-07-07 01:40:48 +03:00
Vencislav Atanasov
c464a81e00 iPod S5L87xx bootloader: Add code for dumping the boot flash to UART
Change-Id: I9513cac0a9463f033456fd7ba7c3db648edf691b
2025-05-31 11:49:51 -04:00
Vencislav Atanasov
6a626a2cae iPod S5L87xx bootloader: Implement the development menu as a list selector
This allows more than 5 items to be added, as every item was bound to a physical button.

Change-Id: Ib03ffe8e7c5f356e170a72bedf35f143051d1eaf
2025-05-31 11:49:51 -04:00
Solomon Peachy
0ebfab36ba surfansf28: More fixes:
* Use 16-bit audio output
 * More audio tweaks (mute on startup, working volume control)
 * Treat the rotary input as a scroll wheel (works now)

To-dos:

 * Better global keymap (incorporate touchscreen)
 * Turn on plugins and define the approximately eight bajillion keymaps
 * Still have some audible pops when we turn on, need to figure out why
 * Default Cabbiev2 comes off as rather crappy on this device

...I don't know how much work I will do on this thing, as the limited
number of physical controls (and a lack of a line-out) mean I'd never
want to use this thing myself.

Change-Id: I37229d92766495219ee989d9ae48b5ed79bd45f5
2025-05-06 09:56:03 -04: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
Solomon Peachy
fb2f56f8a6 hibyos: "run script" now invokes "/bin/sh" instead of "sh"
Change-Id: I409b8deaf7150abb0c00204e596bf8906b3fdc46
2025-04-26 09:57:59 -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
Aidan MacDonald
4d3190f416 arm: split ARM cache maintenance functions to separate header
Cortex-M processors don't have an MMU, but can still have caches
that need software management, so on those platforms we don't want
to include the MMU related functions.

While here, remove an outdated section of a comment referring to
deprecated cache maintenance functions which no longer exist.

Change-Id: I6f0fe694560bdee25ed7c69a846bf46e3e544cb1
2025-04-21 12:39:47 -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
Solomon Peachy
9e79ebf78d bootloader: Fix red on hosted bootloaders
Fixes: 888ce7cae8
Change-Id: I802779cf158634d5b3b547d74999798cb56d2882
2025-04-17 08:31:33 -04:00
Solomon Peachy
888ce7cae8 disk: Dump partition tables when we can't find a usable partition
Change-Id: I10a1b4f149657da4292f34ac8a14e58ec6cdcf72
2025-04-17 08:15:13 -04:00
William Wilgus
4f3bbeaffc Remove BATTERY_TYPES
Change-Id: I4fa03a10d0032fd6f92722bbe1d4b7eec0b95cb4
2025-03-11 02:26:38 -04:00
William Wilgus
43ab8dc413 [Fix Red] Fix remaining red from, Import battery tables
Change-Id: I0b41a90089843adfe49da453d76c0c3ef0c78057
2025-03-06 13:10:32 -05:00
William Wilgus
10f8312db4 FS#13538 export and import battery level tables
when battery_bench is run
exports a file in the rockbox directory called 'battery_levels.default'

if the user wants their own levels they can rename the file battery_levels.cfg
and it will be loaded at boot

some minimal error checking is performed prior to using the values

added manual entry

Change-Id: Ia0126faced0c7229fcf8385a1bcb584b5a9dc378
2025-03-06 11:54:21 -05:00
Vencislav Atanasov
fc4e0d912e iPod S5L87xx bootloader: Move variable declaration to avoid macros
No change in the bootloader binary for ipod6g.

Change-Id: I17a91ec8a710250b5400b06f9520360b814d1184
2025-01-27 10:58:31 -05:00
Vencislav Atanasov
f566f63b63 iPod S5L87xx dev bootloader: show error code if OF fails to boot
Change-Id: Ie00bcdd81b9385b89389ea90b6b0581f6142c37e
2025-01-19 14:52:01 -05:00
Vencislav Atanasov
f179fc1079 S5L87xx bootloader: Add option for viewing SysCfg in the development bootloader
No changes in regular bootloader binary. Tested the development bootloader on ipod6g.

Change-Id: I7a4127bf315addcc5ee4dd8b17dd6b180eb9af76
2024-12-20 08:00:41 -05:00
Vencislav Atanasov
e27f778fb6 S5L87xx bootloader: Change ATA/HDD references to Storage
Tested on ipod6g. No changes besides a text string.

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

Change-Id: I3e527f3e36ab12682a54fc34c40d1ae0c2a7c797
2024-12-17 21:19:15 -05:00
Vencislav Atanasov
296247612d S5L87xx bootloader: Add development menu (disabled by default)
A new flag S5L87XX_DEVELOPMENT_BOOTLOADER is introduced, to replace some of the bootloader functionality with debug/development menu. Not intended for end users, so it's not enabled unless explicitly specified when building

No changes to the binary if the new flag is not enabled.

Bootloader with the flag enabled boots on ipod6g.

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

Change-Id: I3f28c94b4c1e29f3635285c7f0fd24a622a80c54
2024-12-17 21:19:15 -05:00
Solomon Peachy
d0172b4dd9 disk: disk_set_sector_multiplier() takes the MULTIPLIER not the resultant size
Change-Id: I3ef924a1359c92bfeb67d7cfba2bc793f4ec0cdc
2024-12-11 12:59:27 -05:00
Vencislav Atanasov
a29b570ac4 S5L8702: Rename nor-* to norboot-*
Since the SPI NOR flash is only used for the bootloader, rename the files accordingly, This is a preparation for the nandboot driver will be introduced, since S5L8720+ don't have an SPI NOR flash anymore.

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

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: Iea835fd2029470bfe9f813631ad4f3db711facc3
2024-12-07 00:56:06 +02:00
Vencislav Atanasov
9b4bab7e0a ipod6g: Move pmu_is_hibernated() from bootloader to PMU driver, misc fixes
Added better comments about the PMU registers, added pmu_set_cpu_voltage() (still unused).

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: I0ca21a49ece007c913c1b199952009e4dcae80e5
2024-11-26 20:15:25 -05:00
Vencislav Atanasov
9e2c85e076 Merge s5l8700.h and s5l8702.h into s5l87xx.h
This is part of the preparation to add support for iPod Nano 3G and Nano 4G. There are some optimisations left, like merging similar blocks of registers that share the same layout, but the base address have changed between SoC generations.

Change-Id: I4f06727b4061977141b65d39ae19591bd5b29680
2024-11-24 15:56:23 +02:00
Vencislav Atanasov
d7b57e33d9 Add support for S5L8720 in various places
Due to its similarity with S5L8702, clickwheel support and sleep can be used as-is on S5L8720. DRAM and IRAM are also configured.

Change-Id: I52f8a3417e6a25c7360b1cae2fb5eed621e2e0db
2024-11-22 16:45:29 -05:00
Vencislav Atanasov
6691214e51 Rename iPod 6G bootloader from ipod6g.c to ipod-s5l87xx.c
This is part of the preparation to introduce support for iPod Nano 3G and iPod Nano 4G.

Change-Id: I0f07f26a00a0b880507418d712a386377bc71c06
2024-11-22 16:45:29 -05:00
Solomon Peachy
c8e1da8e90 ipod5g/6g: support DEFAULT_VIRT_SECTOR_SIZE
This way if there's no valid partition/filesystem we still report the
"correct" sector size out via USB.

Update the ipod5g/6g bootloaders so they do the right thing too.

Change-Id: I0d93ae7e6664f1591d8edf1c0252c586e329cd4b
2024-11-09 17:48:09 -05:00
Dana Conrad
f6b9e923dc ErosQNative: Re-enable OF recovery
This is needed to be able to do updates to the OF due to the fact
that the OF reboots when you select "update firmware".

By default, most OF update images do not update the bootloader,
but it is easy to modify them to do so, and they already contain
a uboot.bin binary.

I tested using the Aigo Recovery from our native bootloader and it
sure seems to work fine.

If we patch the OF update images to load our own native bootloader,
this will be doubly necessary for uninstallation.

Change-Id: Id69b0321e293331b3936c3f3e7e012d5f00b479a
2024-08-27 09:23:53 -04:00
Solomon Peachy
e2fb4ecd5c xduoox3: Completely strip USB support out of the bootloader.
Change-Id: I7167e051a56a3be3c285c209b1c8fca7de251b09
2024-07-03 16:51:58 -04:00
Solomon Peachy
36fdd3dfed bootloader: Improvements for hibyos targets
* Make sure SD card is mounted prior to reading or writing
   boot mode file
 * If rockbox boot fails, fall back into the tools menu
 * Use a 1s timeout instead of 10s if booting from previous mode
   (special case for first boot)

Change-Id: I61e1ee1ee5c2a1849a2632220275ae7767fae823
2024-06-30 15:05:08 -04:00
Solomon Peachy
8fb2cedc8e coldfire: Fix bootloader builds on GCC8
(missing 'static' on an inline function definition)

Change-Id: I46318443d45dc6d3141fce5c8162c04eb242b4a2
2024-04-26 07:21:46 -04:00
Roman Artiukhin
c36d7768c5 Sansa e200v2: bootloader: fit size
Max allowed size: 120860
Old thumb build: 128494
New thumb build: 118514 (fits!)

Disabled:
Logo;
alpha blending capabilities for bitmaps;
Arm stack unwinder (backtrace);

Related forum discussion: https://forums.rockbox.org/index.php/topic,54768.0.html

Fixes FS#12380

Change-Id: I978720d795cb0ef5169103e467cf8386c21d8e93
2024-04-01 11:02:04 -04:00
Aidan MacDonald
1e9ad3ca0d Remove buflib allocation names, part two
Remove allocation names from the buflib API and fix up all callers.

Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-13 10:32:54 +00:00
Aidan MacDonald
b4e7c60c6d Shanling Q1: Disable recovery kernel boot option
The Q1 handles firmware updates by unpacking the firmware image
from the player app, then rebooting into the recovery kernel.
The recovery kernel reflashes the player kernel and rootfs with
the unpacked update files on the SD card.

Booting the recovery kernel directly is therefore not useful to
the vast majority of users; remove the option from the recovery
menu and remove the key combo.

Change-Id: I6cebfb6a3514ff2ae7d6f3904ac93b481773799b
2022-10-29 12:51:05 +01:00
Aidan MacDonald
a5b08d0af7 Shanling Q1: Support OF-initiated firmware updates
It's now possible to install OF updates on a rockboxed Shanling Q1.
Previously these didn't work because the RB bootloader interrupted
the update process.

Updates will proceed as they normally do on a non-Rockboxed Q1,
except at the end of the update you'll reboot to Rockbox instead
of the OF. This is only a minor inconvienience and doesn't affect
the update process.

Change-Id: I0f8fc96f073c50c1512bf60e0927491be8178eb0
2022-10-29 12:51:02 +01:00
Aidan MacDonald
4101aeac54 x1000: simplify NAND command macros
There is actually no need to parameterize most commands with row
or column cycles, usually the opcode and row/column address width
are linked. When this is not the case we can use raw SFC commands
or define new macros.

Change-Id: I22459d732dc01012e6a8ae026c4fb85495d372b4
2022-07-21 11:39:19 +01:00
Aidan MacDonald
2fce0a98f8 x1000: add flash ONFI info dumper to bootloader
Dumps parts of the standard ONFI info located at page 0x01
of the OTP area to a file for easy copy'n'pasting.

Change-Id: Ie0ba66d27c400737f14deec7c21e9dcb144028a6
2022-07-19 13:43:38 +01:00
Aidan MacDonald
45e2d5d641 x1000: check for ECC failures in bootloader uimage reader
Update the uimage reader's bad block handling to treat an ECC
uncorrectable error on the first page of the block as a bad block.

Change-Id: Id3aa7a338fcc36c0e2381063b119efe41f957122
2022-07-19 13:15:26 +01:00
Aidan MacDonald
ad8ace53e5 x1000: remove 'typedef struct' from NAND driver
Using 'typedef struct' is not in line with the project coding style
and somewhat problematic, so get rid of it here.

Change-Id: Icfe79de72ed82cb7526e9f4e8296ec12084c01ac
2022-07-10 15:22:10 +01:00
Aidan MacDonald
4d01168b9b x1000: add flash probe tool to bootloader
The flash probe mimics the boot ROM's flash read routines and
dumps the manufacturer & device IDs and 16-byte parameter data
to a file on the SD card.

Change-Id: I3d413bd0cc05a9d7f2285b85454420c3e90274e9
2022-05-30 14:08:02 +01:00
Dana Conrad
7aa2a23b95 Eros Q Native: Add Original Firmware Boot option
Hold "Play" to boot the OF, or boot it from the recovery menu
by holding "Vol. Up". If you had the hosted port installed on your
player before installing the native port, you'll still have to go
through the hosted bootloader.

A couple notes:

- When booting from the menu, the recovery menu disappears, then
  reappears before going into the OF.

- You need to hold the play button for like a half second after the
  blue light comes on in order to get into the OF.

The recovery appears to be there, but it doesn't seem to be intended
for end users - it just says "Updater V1.1 - Insert TF Pls". I haven't
tested it beyond seeing that it boots, so I'm going to comment it out
for now.

Change-Id: Ie271ee479bb628cc74141b7fe07273b3f193f358
2022-04-01 12:04:30 -04:00
Aidan MacDonald
bd8cd58568 x1000: bootloader: Add button handlers for OF boot
The SPL soon won't be paying attention to buttons, so the bootloader
should check them.

Change-Id: I2048ca9fd19193f329bebecfefd986760c33fd68
2022-03-25 21:36:51 +00:00
Aidan MacDonald
cda8bd5437 x1000: bootloader: set touchscreen to button mode
The touchscreen "buttons" are used for screenshots on the Q1.

Change-Id: I6bff00976c614d203986e810e51f859e78e372ab
2022-03-25 21:36:51 +00:00
Aidan MacDonald
6bc69c797c x1000: bootloader: accept button input during splash
This allows screenshots to be taken while a splash is displayed.

Change-Id: Id494189283db1b6877416f5a1ef1a13c8b654507
2022-03-25 21:36:51 +00:00
Dana Conrad
3d88f455cf Fix double define of BL_SCREENSHOT_NAME on fiiom3k
Change-Id: Iaee40887de19ac2d78ec9bdea08cee678b7e50ef
2022-03-25 21:36:51 +00:00
Aidan MacDonald
5160c90690 x1000: bootloader: add screenshot function
Screenshots of the recovery menu will be useful for documentation.

This can be disabled by turning off HAVE_BOOTLOADER_SCREENDUMP in
the target config file if the bootloader should ever run up against
max size limits.

Change-Id: I62ec1e465df2ca7a8a0e78625d88b31f6c4ef078
2022-03-25 21:36:51 +00:00
Aidan MacDonald
4cf36dfbf3 x1000: bootloader: skip bad blocks when loading flashed kernels
Bad blocks in a kernel flash partition seem to be handled by skipping
ahead to the next block; this is a common bad block management scheme
for simple software like bootloaders (and is the default method for
reading NAND partitions in u-boot).

Extend the uImage flash reader to skip bad blocks while reading.

Change-Id: I815875e83a2418e2642f736e04a3437c31b354ba
2022-03-25 17:31:39 -04:00