Commit graph

599 commits

Author SHA1 Message Date
Aidan MacDonald
c249dea2b7 libsetjmp: fix unpredictable behavior warning on ARM Cortex-M
GAS warns about unpredictable behavior of "ldr sp, [a1], #4"
that exists on Cortex-M3 (errata 752419) but this warning is
incorrectly issued on other cores too (eg, Cortex-M7).

Since the fix is just one extra instruction we may as well
apply the workaround for all Cortex-M targets.

Change-Id: I0c2aa46837f776d67d0236b627af1572aa5ab307
2025-04-19 11:24:01 -04:00
Aidan MacDonald
96b6a7b4e4 arm: implement get_sp for Cortex-M
On Cortex-M we can just return SP directly, which will return
PSP/MSP depending on the current processor mode.

Note that unwarminder doesn't handle Cortex-M exception frames
yet, so a panic from an interrupt handler will currently stop
at the exception boundary.

Change-Id: I8818126c065c896d781bd52b877965a4094dee2a
2025-04-18 12:47:03 -04:00
Aidan MacDonald
a0bfcd77c8 arm: enable unified assembly syntax in more files
This makes these files compileable, or in some cases less
broken, on Cortex-M targets.

In lcd-16bit.c, newer versions of GAS complain about the
infix condition codes so we use the suffix form instead,
which requires unified syntax to compile on GCC 4.9.

Change-Id: If45166d3fc83d64c692cbb331096a966397aa9e9
2025-04-18 10:26:02 -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
Roman Artiukhin
ed40c5a036 metadata: opus, vorbis, speex: Don't fill metadata buffer with album art and cuesheet
Fixup for 0847bcc1. Fixes FS#13586

Change-Id: I2af63747266bf0dea85812354caadca432dfcd32
2025-04-01 08:33:16 -04:00
Roman Artiukhin
849e8abe8d metadata: opus, vorbis, speex: Fix 0 is supplied as base64 char when parsing album art metadata
For some reason it caused a crash on asan enabled simulator builds but worked fine otherwise.

Fixup for 0847bcc1 and ac8714dd

Change-Id: Iff1c2779d5fa6889c743cdccd8e1feaf55684394
2025-03-28 10:13:16 -04:00
William Wilgus
8d2226f952 [Feature] Add failure messages to metadata logging
Previously logging just showed that the file was
passed to the function without any indication that
the parsing failed

Adds status strings to record failure to open, missing parser, parser error

Change-Id: I5234153464bab9a5f9fb765d5e1cfa59dfe0ebfe
2025-03-11 12:16:00 -04:00
Solomon Peachy
5829701fba skin_debug: Also dump the parameters to viewports
Change-Id: Ic9ae330fa6202df67f201911a09ebb7f8c165c8a
2025-03-07 09:46:54 -05:00
William Wilgus
ac8714dd64 [BugFix] vorbis.c metadata invalid index when album art b64 is NULL
Change-Id: I9d08c2e2c903c00d0b2fd25e0dceea28113874a2
2025-02-28 00:27:10 -05:00
Solomon Peachy
dc0cef8304 libopus: Re-add another optimization that was accidently dropped pre-3.15
This puts the entire ~26K decoder state structure into IRAM.

(was lost as part of 14c6bb798d, Nov 2019)

Change-Id: Idbf53657e7c0581b4e47247fc5550b59842b23f1
2025-02-12 08:51:37 -05:00
Roman Artiukhin
0847bcc110 metadata: opus, vorbis, speex: support embedded jpeg album art
It includes .opus, .ogg, .oga, .spx files

Change-Id: I3d0ee9806b05911fc8c3ce5cb761de87d4166141
2025-02-08 10:02:21 +02:00
William Wilgus
b94b0d3bf4 Skin engine, optimize hot paths
callgrind identified check_viewport and scan_int as pretty hot code paths on startup
and playback

check_viewport uses strlen to check the string has at least 4 characters
we can just check if str[3] != '\0' without walking potentially much further
and no function call..

scan_int was building a buffer for atoi to parse when we can just do it in the loop
directly

Change-Id: Ie028980333cbed4c066d8ea547a89cf4fad76808
2025-02-08 00:49:28 -05:00
William Wilgus
02c256565f [FixRed] Reove HAVE_PITCHCONTROL from bootloaders, fix warble
Change-Id: I85a3580bd5fac881ca36efc260791d03f0b8c83a
2025-01-19 01:20:58 -05:00
William Wilgus
4e271642df [Feature] Persist pitch settings through reboots part deux
Revisit this after discussion with chris_s on IRC and forum

Pitch menu now changes icon when pitch has been changed

uses NVRAM to save the pitch settings unconditionally

Manual updated

Change-Id: Idcb4c2b7fe42f7a203dc4bfc46285657f370d0fd
2025-01-19 00:29:47 -05:00
Roman Artiukhin
7f4a8891a6 metadata: mp3: Support unsync embedded jpeg album art
Support parsing alubm art from id3 metadata with "unsynchronisation scheme":
https://id3.org/id3v2.3.0#The_unsynchronisation_scheme

Change-Id: I1e2ca4ae0aa967f7e80142a04c9a7d99e38e68b2
2025-01-16 10:08:41 -05:00
William Wilgus
dca70e1816 compressor remove static delay line buffer
core_alloc works well for this and we can allow the alloc to be moved

bugfix compressor_process() possible buffer overflow

Change-Id: I701c6306c39cc1c7aa72b0dbe402b9b0d1a3fcda
2024-12-27 02:34:18 -05:00
William Wilgus
1643e0e287 [Bugfix] metadata.c copy_mp3entry() dest and orig may overlap
I meant to add this with the last patch b07d7d6
since it may supply UNBUFFERED_ID3 to the peek function
which uses UNBUFFERED_ID3 and will try to copy it back
wich is undefined behavior for memcpy

Change-Id: I91160570adac22134c84d3b37f8fcecb097d87d6
2024-12-26 01:29:02 -05:00
William Wilgus
25ab00465e metadata.c don't store encoder filename for all the decoders
there are only 4 encoder capable codecs just make it a function
and add a macro to keep it sane

Change-Id: Iac8833226434f8436bc678f3e409f462764d8fdc
2024-12-24 01:47:18 -05:00
William Wilgus
7c678f5e7a [Feature] %ft file text tags add prefix search
%ft(filename,search_text)
finds a line beginning with search_text strips search_text and returns
the remainder of the line

Change-Id: I06fe029b89aa60e4dbf34c039d180c75213519a4
2024-12-22 01:11:10 -05:00
Christian Soffke
727c800c0d Don't force gcc as host compiler + fix clang warnings
On MacOS, gcc is a symlink for clang.

Patch gets rid of the warnings produced by clang,
when it is set as HOSTCC, and fixes voicetools
compilation on MacOS when calling make voicetools
from the simulator directory.

lua rb_defines_helper:
format specifies type 'int' but the argument has
type 'long'

codecs: opus / speex (LOGF):
format '%ld' expects argument of type 'long int',
but argument 7 has type 'off_t'

gigabeat:
variable 'size' set but not used

rdf2binary:
a function declaration without a prototype is
deprecated in all versions of C

rbspeexdec:
passing 'unsigned char *' to parameter of type
'char *' converts between pointers to integer
types where one is of the unique plain 'char'
type and the other is not

hmac-sha1.c
defining a type within 'offsetof' is a Clang
extension

Change-Id: I90539906698868f9589650585d865aee9f7e8539
2024-12-20 05:29:18 +01:00
Christian Soffke
a86b1999d0 simulator: fix missing Werror option + eliminate lib duplicate
configure:
Ensure Werror option doesn't get lost when simcc resets GCCOPTS

uisimulator.make:
Remove ignored duplicate SIMLIB on Darwin

codecs.make:
Eliminate some redundancy

Change-Id: Ieee6f677fd22666cb58aa6fe53eabdc0b0f8c190
2024-12-19 15:04:46 -05:00
Vencislav Atanasov
1468649258 Convert non-ASCII characters to UTF-8 or C-string literals
Comments are converted to UTF-8.

Strings which are part of executable code are converted using C-string hex literals. A comment with the intended UTF-8 character is appended to such lines.

The "c"-looking character in mpa.c was actually a small cyrillic "s" (i.e. "с").

Change-Id: If3a889080ef60b8bf756ad9ada38baede93ce35b
2024-12-15 21:16:12 -05:00
Vencislav Atanasov
5d7c8a0df1 Convert non-ASCII characters to UTF-8
Comments and notes are converted to UTF-8. Already broken multibyte characters are fixed using common sense.

This patch contains no code changes.

Change-Id: Ia511ab84936cb2495ac17309493a9b98727a7902
2024-12-15 21:16:12 -05:00
Roman Artiukhin
de8d1437dc metadata: asf: Use system utf16decode conversion
Change-Id: I606bf5365c84cbee4badd1ac1cbaace1207834f4
2024-12-15 15:44:57 -05:00
Roman Artiukhin
1f548f74e6 unicode: add utf16decode with utf8 buffer size check
Make use of it in id3tags and cuesheet

Change-Id: I153c23f1f7312e9d5e1de9f03725f2d2ab0abc93
2024-12-15 15:44:57 -05:00
Christian Soffke
63d8aa0077 metadata: mp3: update out-of-date comments
(L1033 + L1170)

As of commit f3e5ced, tags will be parsed
unconditionally, regardless of whether
they've been filled already.

Change-Id: I7edd4b7131b33dba34f06ebe829ebdc00a138525
2024-12-15 09:27:06 -05:00
Roman Artiukhin
004304dc65 unicode: add iso_decode_ex with utf8 buffer size check
Make use of it in id3tags, playlist and cuesheet

Change-Id: Ibc8abc0faf16688bc9b826b7a712d1dfe9bf75b2
2024-12-15 09:26:26 -05:00
William Wilgus
f233b6e2f2 'libmad remove warnings
calculating inside a function makes it work
adding FORCE_INLINE makes warning reappear
anything else in bounds of the array asounds ok but has digital
distortion so pretty confident the code is right

Change-Id: Ibb2babe20b1d8a980f3e3fd19b4cddaaff9213a6
2024-12-14 01:21:56 -05:00
Christian Soffke
4cf65ec926 metadata: mp3: fix iTunSMPB info replacing comment
Data from the iTunes seamless playback data field
(support for which was introduced in f3e5ced)
prevents proper comments from being displayed.

Change-Id: Ifb00b1229e636a79a460ba6d706191fcf28b1502
2024-12-13 20:49:18 +01:00
Roman Artiukhin
a23002cd5e unicode: Unify check for UTF-16 BOM
Adds utf16_has_bom function

Change-Id: I67ea474c9cf6ca6e6684351c2f54131164b7903c
2024-12-13 17:38:05 +02:00
Roman Artiukhin
11fbbc7826 metadata: mp3: Reduce size of is_cuesheet function
Saves 80 bytes on Sansa E200V2 (176 -> 96)

Change-Id: I976e47f74641110ef37049101b9eb0db0afe512b
2024-12-13 17:09:29 +02:00
Roman Artiukhin
f7d5da6b2f metadata: mp3: Limit utf-8 buffer stack allocation to prevent stack overflow
Fixes FS#13518

Change-Id: I549ecb21c3dbaba580c13a6a155559585f0aa08e
2024-12-11 11:36:09 +02:00
Roman Artiukhin
18520c27a5 metadata: mp3: Avoid utf-8 buffer stack allocation for utf-8 tags
Change-Id: I9f35fc017efa6e8f36cd295adf662612cf9c6c16
2024-12-11 11:36:08 +02:00
Roman Artiukhin
c1ee278abf metadata: mp3: Avoid utf-8 buffer stack allocation when processing cuesheet
Change-Id: Ife49d5e3f2850e8621f927a4864d7863c103db77
2024-12-11 11:36:08 +02:00
William Wilgus
e9b14b3986 libmad synth.c silence warnings try #3
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I7b2897ae20dad1b11af39439a4d1856267b1222b
2024-12-10 11:16:40 -05:00
Solomon Peachy
95681c3959 Revert "libmad synth.c silence warnings try #2"
This reverts commit 5650007399.

Reason for revert:  Results in warnings on *all* device builds.

Change-Id: I635be6791c3ea9c7d7e89f9cf5dd2e4e4e042a80
2024-12-10 08:59:00 -05:00
William Wilgus
5650007399 libmad synth.c silence warnings try #2
https://godbolt.org/z/3bM7fxPP3 shows some of the disasm around the troble area for compiling

Change-Id: I135af6df5569fb4b6d18d79f7893b5c27f6f83ea
2024-12-10 02:17:55 -05:00
Solomon Peachy
e3323e3ba7 Revert "libmad synth.c silence warnings"
This reverts commit b14056e90f.

Reason for revert: Not mathematically equivalent, inconsistent with other code paths, and leads to audio artifacts on ARM targets.

Change-Id: I71646e6e8df2aa2c57decdb5360daff870670c87
2024-12-08 19:14:01 -05:00
William Wilgus
ca79fd039c skin_parser add empty parser callback remove guard conditionals
it appears callback is only set once in skin_parse() and then its never touched again
making repeatd checks pointless anyway

Change-Id: Iae4cb064b17f9c4e89a3ef772110ead17332cba2
2024-12-08 15:12:28 -05:00
William Wilgus
33cbefb310 skin_parser Reduce ram usage for conditionals on %ft() file text tags
the skin engine calls the tags for each conditional to check them since %ft
erases it's var if the file doesn't exist %?ft is likely only being called
to check existance of a file or line of a file

this patch allocates 2 bytes to satisify the conditional if the line exists

Change-Id: Ic74bf5fec9a5d9b6724692c49a0997bfa4cff48d
2024-12-08 03:52:38 -05:00
William Wilgus
ebd1021fe4 [Bugfix] Pt doesn't return length of the next track
fix yellow in mp3_encoder

Change-Id: I1658250141d3ea00b56da0258e111ca76aa56b53
2024-12-08 00:28:16 -05:00
William Wilgus
b14056e90f libmad synth.c silence warnings
synth.c is using a negative offset which gcc doesn't like

equlivalent code just uses pointer math instead

Change-Id: Ia1282c5608409cdff05cd4b90c4d4b695174482a
2024-12-08 00:06:59 -05:00
William Wilgus
44bfffd7c5 [Feature] skinengine subline timeout hide line for n seconds
builds on top of the file text patch to add hide timeouts to
subline text tags

this allows you to specify both a show time and hide time
for these elements

%t(show, hide)

also removes the 327 second limit for timeouts whne this form is used

Change-Id: If4598dcc24d0c7be4380e7595b7d91c7eba3a728
2024-12-07 23:02:22 -05:00
Solomon Peachy
e6851a55ed Revert "[Feature] Skin engine Themes grab text from a file %ft(file, line) WIP"
This reverts commit 62b5dfd81d.

This was accidentally merged, and wasn't up-to-date anyway.

Change-Id: I4fcceb8dc4f86762701daab72498202cabd8295a
2024-12-07 13:48:05 -05:00
William Wilgus
62b5dfd81d [Feature] Skin engine Themes grab text from a file %ft(file, line) WIP
allow the skin engine to read text files and return a particular line

you then can use ss on that string to allow display of strings from the file
(Playername comes to mind)

able to be used as conditional
%?ft(filename)<Found|Not Found>

if (selected) line of file is empty the tag is treated as #COMMENT

scroll timeouts now persist thru trackchange

bugfix:
%t(n)%?x<text|text>
would ignore the specified timeout defaulting to 2 seconds

playername.txt generated at boot if it doesn't exist contents: 'RockBox!'

Change-Id: I961910e01be052ef902f77e6d92fc3e367ffe9d0
2024-12-07 13:21:21 -05:00
Christian Soffke
87452d775e fix warnings on some systems / format specifier mismatch
Instead of %ld or %lx, use %jd or %jx
for off_t (after casting to intmax_t)

Change-Id: I4cd1831816820d2862b383ff8782e548b2fca294
2024-12-07 11:07:44 -05:00
Solomon Peachy
d114429d88 skin_debug: Fix missing PERCENT tag dump
Change-Id: Ie4041d5666c3a53439e23363d89b9bbf40241a42
2024-12-03 20:37:55 -05:00
Solomon Peachy
00d7a93987 themeeditor: Fix compilation
This thing is suffering from some serious bitrot, but at least
it compiles again.

Change-Id: Ie2c55697dddbca3a758ace5047d1c372ee478a07
2024-12-03 20:16:30 -05:00
William Wilgus
793c797447 [Fix Yellow] remove DEBUGF from skin_parser.c cleanup spaces
move const to the proper side

Change-Id: Ide7c1878281eaee28d06426eee43041ad61acbc4
2024-12-03 01:48:50 -05:00
William Wilgus
68d4fd0e5b skin_engine minor refactoring struct alignment No Functional Changes
Move some elements around to save 720 bytes in the skin engine with cabbie

saves some code manipulating the skin_helpers arrays in skin_engine
eliminate conditionals checking for pre/post process functions
using a dummy fn(), consolidate pre/post process into a single function
adding a bool preprocess to indicate stage

Change-Id: Id2df4706b73e9025c7300be135dc02e135e587fe
2024-12-03 01:21:28 -05:00