Commit graph

11328 commits

Author SHA1 Message Date
Aidan MacDonald
981e972839 mips: add native backtrace implementation
Should make debugging crashes on native MIPS targets far easier.
This is by no means a 100% complete or robust implementation but
it seems to handle the vast majority of functions.

Change-Id: Id5f430270e02b5092b79026b6876675c784aa649
2022-05-22 07:16:11 -04:00
Aidan MacDonald
2315266628 kernel: remove unused function mutex_test()
No longer needed since the only user was in the Archos code.

Change-Id: I763f58050c70f2bb1d8cc0a044c63698f3157a8d
2022-05-14 11:29:55 -04:00
Aidan MacDonald
dafc8e5904 kernel: remove unused kernel/pthread/*.c files
These don't seem usable and it looks like the files were added by
accident by d66346789c "buflib: Check the validity of of handles
passed to buflib_get_data() in DEBUG builds."

Change-Id: I4d4601f1fef7901c08ae86448853d008f48d5f43
2022-05-14 11:29:55 -04:00
William Wilgus
79864c6ec2 add const to const * strings
I don't think this will amke any difference except maybe for hosted ports

Change-Id: I84f898aea92a6963901a6d889dd18b63f24c9a41
2022-05-03 23:00:58 -04:00
Aidan MacDonald
a234df30df Fix sim build for glibc >=2.34
Change-Id: If63787514b6bffc0afb71f9d651f8c6f0c328a2d
2022-04-18 09:54:07 -04:00
Aidan MacDonald
fca7b8e2ff Fix undefined behavior that blocks compiling with UBSan
Left shifts are not defined in C if they would cause signed overflow,
so these expressions get instrumented, which makes them unusable as
switch values and triggers compile errors when compiling with UBSan.

Change-Id: I0588d4be1e00ba1cfde0eac119ead368b20d10c9
2022-04-17 11:37:34 -04:00
William Wilgus
c4156b1909 viewports, set flags to VP_DEFAULT_FLAGS
flags were getting un-initialized memory
it really didn't matter with the flags getting initialized
anyway
But once I added a new flag that didn't explicitly
set or clear the flag at init well here we are

set flags to VP_DEFAULT_FLAGS in viewport_set_defaults()

add the flags variable to the default vp's set to 0
(it was already initialized to 0 by bss, make it explicit)

Change-Id: I3a9a062455b4cf66d2b8c70fdf05402a5c0c091c
2022-04-17 10:59:56 -04:00
Aidan MacDonald
d55dceff37 apps: Add ability to do a clean reboot
Allow a clean shutdown to end in either power off or reboot. Add a
new event SYS_REBOOT to signal it and sys_reboot() to trigger the
event. SYS_REBOOT signals a reboot request and should be listened
for alongside SYS_POWEROFF events.

Change-Id: I99ba7fb5feed2bb5a0a40a274e8466ad74fe3a43
2022-04-16 14:36:39 +01:00
William Wilgus
ff08841ea9 viewport FIX RED remote screens
Change-Id: I894a5c3e9053f44dee4803e9cdbbcb8f651ee318
2022-04-15 08:16:28 -04:00
William Wilgus
d56d96031c viewports add flag to disable updates
when drwing multiple areas of the screen with other gui elements
you might want to combine updates into a single screen redraw

Change-Id: Ie4130366fa13e25d3d14e937257d11547dd61134
2022-04-15 01:54:42 -04:00
Aidan MacDonald
98f762316f system: update MEM_ALIGN_ATTR for targets with CPU caches
MEM_ALIGN_ATTR should take advantage of cache line alignment on
all native CPUs which define it, not just ARM CPUs. (This could
arguably be done for hosted targets too, but we don't necessarily
know the size of a cache line there.)

Change-Id: Ife9302105ea57388afd55ce31da848b00b5b1b25
2022-04-01 12:08:41 -04:00
Dana Conrad
de285741bf ErosQ Native: Make power delay bootloader-only
gotta go fast

Change-Id: Ic01e4aa70a2bec4c48ae7cf8f32f8dfd366decad
2022-04-01 12:04:46 -04: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
4f05a9d066 Add path_strip_last_volume
This gets the volume that the path eventually refers to by parsing
the last volume specifier and returning the part of the path after
it (which does not contain any volume specifiers). The initial part
of the path therefore contains everything up to and including the
last volume specifier.

Change-Id: I9a935543256f8f22e0b8b1e3c88d4e47bd9dae8a
2022-04-01 11:40:02 -04:00
Aidan MacDonald
412dbaeffe hosted: call 'sync' before poweroff
Might be needed to avoid filesystem corruption with buggy OF kernels.

Change-Id: I589eec6c1536beccf849716f11204b4b83a942a1
2022-03-31 21:40:04 -04:00
Aidan MacDonald
7243f6b343 x1000: Add multiboot support
Enables multiboot for the FiiO M3K, Shanling Q1, and Eros Q native port.
Note this requires an up-to-date Rockbox _and_ bootloader.

Usage instructions will (eventually) be found on the wiki:
https://www.rockbox.org/wiki/MultibootBootloader

Change-Id: Ia2da1ad6ef611e499d2fbafa93838387bc1023ba
2022-03-27 10:35:02 -04:00
Aidan MacDonald
bcbb5a8b00 multiboot: Allow searching in volume 0 for redirect file
Searching in volume 0 is necessary for multiboot targets with only
one drive, like the M3K/Q1/ErosQ. Without this the search code will
never look at the redirect file on these targets.

The search bound is configured with a setting MULTIBOOT_MIN_VOLUME,
which defaults to 0, but is defined to 1 for Sansa players so they
keep their old behavior.

Change-Id: I6dc5cf98db4258731de2c68c3ab1182b4a4a655b
2022-03-27 09:50:33 -04:00
Aidan MacDonald
5d0f697e87 x1000: remove the last vestiges of boot option support
There should be no need for any compatibility hacks since this
value was mostly used internally between the SPL and bootloader.
clk_init() was the only user in the main Rockbox binary which
accessed it, but when loaded by the Rockbox bootloader that code
will not be reached since BOOT_FLAG_CLK_INIT is already set.

Change-Id: Idd68b9834172e652b47432bfb1e00c923ea35407
2022-03-25 21:36:51 +00:00
Aidan MacDonald
3ae4a98e3b x1000: spl: remove selectable boot option support
Now the SPL boots the Rockbox bootloader unconditionally, which
allows for some simplification.

Change-Id: Id75c82db25a87e0e9043bb0771f622b1fc9482fb
2022-03-25 21:36:51 +00:00
Aidan MacDonald
2810c549a6 x1000: spl: remove dual boot support code
Removes the SPL's dual boot support code, and removes the dual
boot selection code on the M3K and Q1 since they can now do it
from the main bootloader.

Change-Id: Ie1b27e98c6ed4b3e37db86cfb485d6f3a6c5b25e
2022-03-25 21:36:51 +00:00
Aidan MacDonald
7cb49cfb33 x1000: spl: split off NAND storage to separate file
Just tidying. No functional changes.

Change-Id: I8aa85c789d1a6bd357797c6c95e38a7325eba809
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
5b011c8dca x1000: add bad block marker position to nand_chip info
Change-Id: I6f466d87f6f11bc3e23463c469f318ecb7049ba7
2022-03-24 23:40:07 +00:00
Aidan MacDonald
41a8b874d2 linuxboot: add meaningful error codes
Change-Id: Ied964e99c389902bb1786c414c5d0fa20056040d
2022-03-24 23:40:07 +00:00
Aidan MacDonald
6a6c6083fa x1000: bootloader: fix Linux self-extracting kernel boot
Basically, there's longstanding bug in Linux with self-extracting
kernels on MIPS which just happened to manifest now on the M3K as
a hang on boot. The fix is applied to the M3K and Q1 since they
both use this type of kernel image.

Change-Id: I17d2bad6eebd677cd6d2e0bf146450c71fcf1229
2022-03-24 23:40:07 +00:00
Aidan MacDonald
44fbb1a593 x1000: bootloader: add LCD dualboot cleanup for the M3K
Disable LCD interrupts before booting the OF - the OF kernel
hangs at boot if they are enabled.

Change-Id: I4f119818d0243953cdd620e17d9509b4fb16cc28
2022-03-24 23:40:07 +00:00
Aidan MacDonald
9bde653410 firmware: allow screendump in bootloader
Enabled if target defines HAVE_BOOTLOADER_SCREENDUMP

Change-Id: Idc135ef81e55d0f3eb8e7d2763d455c6455cf8fd
2022-03-24 18:59:50 -04:00
Aidan MacDonald
e956f7dc83 firmware: minor screendump related cleanups
- Remove unused redefinitions of screen_dump() from bootloaders
- Use empty do-while when screendump is compiled out

Change-Id: I3ccdb0390ddaa28d8f561ff744d0db6aaef17f5d
2022-03-24 18:59:50 -04:00
William Wilgus
cfeeb7889d Lcd save function pointer to frame buffer get_address_fn before loops
Calling multiple levels of indirection in a loop slows things down

Really these need to be rewritten to take a start and end address
like most of the rest of the codebase

But this is safer without having test hardware in hand

Change-Id: Idae7b92ee779d020ed7fcc9334e2d5a9c710e64d
2022-03-21 23:53:48 -04:00
William Wilgus
60e5786b48 lcd-bitmap-common optimize a few viewport functions
Change-Id: I71cd61f66e875280d07f17a9e828fbecc305bad2
2022-03-21 10:00:04 -04:00
William Wilgus
b65763bc10 [COV] fix uninitialized warning
Change-Id: Ib526aeac51d626d02b073b26efd3020115641caa
2022-03-18 20:19:18 -04:00
Aidan MacDonald
67f7d399e5 x1000: restore crt0.S cache flush
I-cache must be flushed after copying code to IRAM... duh.

Change-Id: I6eacc4b7c4385175724c947f6c53f7bbddcb6295
2022-03-16 23:21:29 +00:00
Aidan MacDonald
c676736792 x1000: optimize crt0.S, improve correctness
Replace inline section copy/fill loops with subroutines, which
reduces code size a bit and and handle zero size copies properly.

Remove the cache initialization loop as well. There's no actual
reason for this because the SPL initializes the caches and just
dropping the cache can even be harmful (in this case it wasn't,
because the SPL flushes the whole cache right before calling in).

Change-Id: I7cddc9ed6d060b1f1bdd75544297883d014cad2d
2022-03-16 12:02:24 -04:00
Wolfram Sang
0df71c952c rds: make newly added function static
It won't be called outside the RDS core.

Change-Id: I22f9d7984213f32ad1db49368327243ba2aa917b
2022-03-16 11:54:26 -04:00
William Wilgus
a5c16d2990 rb_namespace add logf
add logging to the namespace file to allow debug of root redirect

Change-Id: I6032aea880998c05dacf3d0d2e0d222205b9376e
2022-03-15 00:45:00 -04:00
William Wilgus
6fdc160fab dircache_redirect.h, hide root volume when only one mounted
there is no need to show the root of the drive when only the
internal is mounted

Change-Id: I310c48befa51742d05b6d5ce501d0b7c2c7c7ab7
2022-03-13 17:40:17 -04:00
Aidan MacDonald
8b4949381c x1000: add TCSM section to linker script
This is intended for debugging OF kernel boot problems and has
to be enabled manually at compile time to make it usable.

Change-Id: Ie5ce9f0a7639be0acf5e3879cfc3a7b8b89caa5c
2022-03-12 14:50:45 -05:00
Aidan MacDonald
d56964cc2b x1000: add dual boot helpers for the main bootloader
Two helpers (_init_clocktree and _init_uart2) already existed in
the SPL and are copied verbatim from there. The SPL versions are
still present and will be removed when dual boot works from the
main bootloader.

The other two helpers (_cleanup and _load_pdma_fw) are new.

Change-Id: I4661667966e26f52e6c5142f1947d2a34b7008ef
2022-03-12 18:25:10 +00:00
Aidan MacDonald
a87f93d8ff x1000: add function for booting linux kernels
Change-Id: I0750b084fe88d21a8686daf0681b32b1dcba8fec
2022-03-12 18:25:10 +00:00
Aidan MacDonald
58225bd2c8 x1000: remove plugin and codec buffers on bootloader
On the bootloader there's no point reserving memory for these,
the only users of codecbuf/pluginbuf are in the apps/ tree.

Change-Id: Ib57b4d59aff8f4dcc753d7993956ed15e61cdc52
2022-03-12 18:25:10 +00:00
Aidan MacDonald
38eafb60ff x1000: use core_alloc in bootloader for loading rockbox
Using the audio buffer directly is a bad idea because this will
render core_alloc non-functional if load_firmware() writes into
the buffer but then fails, for example on a checksum mismatch.

Change-Id: Ib2d17bcea53bdea1c4c5496cec0c4eee5dd66069
2022-03-12 18:25:10 +00:00
William Wilgus
97ec0a7e73 Root redirect un-hide root volume
this appears to be problematic for now

Change-Id: Ieb789f5ec10a0d25c559e9bfc2497cbc4f59c0ad
2022-03-11 20:11:31 -05:00
Aidan MacDonald
603412f447 x1000: Clarify definition & usage of RAM areas
Document what the symbols are supposed to mean, fixup SPL's
usage of DRAM_END which should really be SDRAM_END instead.
No functional changes.

Change-Id: Ie85b0ee35fea8b7858891e5b9d6634eaae42c9f8
2022-03-11 11:15:56 -05:00
Aidan MacDonald
428491df69 x1000: support new binary header in rolo
Change-Id: I192c3d69616c39534ff329174c4d8d4a357d014d
2022-03-11 11:15:56 -05:00
Aidan MacDonald
7fa48faeb5 multiboot: Refactor duplicated functions to a separate file
The implementation of write_bootdata() and get_redirect_dir() was
copied verbatim in two different places, obviously a bad thing for
maintainability. This moves them to a new file multiboot.c as they
are only used for multiboot.

Change-Id: Id0279216e4dd019f8bf612a81d3835eff010e506
2022-03-11 10:58:20 -05:00
Aidan MacDonald
439b4e8bca multiboot: Remove bad multiboot code from hosted RoLo
This looks like it was copy-pasted blindly from elsewhere and it
wouldn't even compile, since hosted RoLo is completely different
from native RoLo.

Change-Id: I4074f5323dcbdae85db8a04f222c858e9a228432
2022-03-11 10:58:20 -05:00
Aidan MacDonald
eae9f6f5b7 erosqnative: Fix missing END marker in LCD enable sequence
Change-Id: I75b3a396174e84d72e70c6f177bc1702021805f1
2022-03-11 10:42:18 -05:00
William Wilgus
f6a2bf28e1 BUGFIX file.c open failure leaves open file handle
Change-Id: Iad8eef2f65af0549da4dbec654c85adb2f325711
2022-03-11 03:18:38 -05:00
Aidan MacDonald
ca12478df6 x1000: add simple binary header to declare the load address
The header format is basic, a variable length list of values
tagged by 4-byte strings. The main application to to allow a
loader to determine the load address of the binary at runtime
instead of using a hardcoded address. But the header contents
aren't fixed and it could be extended for other purposes too.

Change-Id: If51d85b4c2eb53c919a91b54985b157e8e5c20ef
2022-03-06 23:22:49 +00:00
William Wilgus
bc3fa53937 Sansa Multiboot Root Redirect Enhance + bug fix
filename buffer was too small to retrieve redirect path

if redirected to sd root remove <SD1> as it is redundant

Change-Id: I1326601f1ba4a18d6bc173798759eb762b55528c
2022-03-06 16:42:26 -05:00