Commit graph

4120 commits

Author SHA1 Message Date
Aidan MacDonald
19af7131e2 echoplayer: allow enabling system debug in normal builds
Allow toggling the system debug state from the debug menu
in Rockbox, or by holding a button combo at boot, so that
an SWD/JTAG debugger can be attached to normal non-debug
builds without too much hassle.

Change-Id: Iee47ef916ade2e5ec1094a63c68e48f1b27b0bbb
2026-02-06 07:09:32 -05:00
Aidan MacDonald
02648abb8a echoplayer: disable 50 MHz SDMMC bus clock
While 50 MHz works for low activity and small amounts of
data, there are frequent CRC errors when handling larger
transfers. Increasing drive strength only makes it worse.
Everything seems stable at 25 MHz though.

Change-Id: I3471c490ab63b2302b21ee2fe601519ee5a40ce5
2026-02-06 07:08:28 -05:00
Aidan MacDonald
45a61d7e7b echoplayer: enable multiblock transfers for SDMMC
Change-Id: I152a6d58b008041d646ddcfec4273a47c4060932
2026-02-06 10:58:42 +00:00
Aidan MacDonald
ebd273832d Remove Mini2440 and Lyre prototype 1 ports
Both targets were part of the (presumably dead) Lyre project
and no longer build. The Mini2440 was much more complete than
the Lyre and doesn't seem terribly difficult to fix up to the
point where it at least builds, if someone still cares -- but
given it is a dev board in a box, it's unlikely it ever saw
much use.

Change-Id: I09745379d28db69ea9aaf77f0a62b049884260e1
2026-02-04 08:56:04 -05:00
Aidan MacDonald
bbe72761a4 ipodnano3g/4g: fix compile issues for normal build
Some purely mechanical fixes to get the normal build
working. Besides missing symbols all the plugins and
codecs build just fine.

Change-Id: I946ba39096a46be8308450bafd51a0995db8e323
2026-02-04 07:51:40 -05:00
Aidan MacDonald
53862c7eed Remove Sansa View port
It doesn't seem to have been functional ever and currently
doesn't build; eg. the last commit to the LCD driver added
a syntax error, and there's some duplicate functions between
mmu-armv6.S and system-pp502x.c. Doesn't seem worth the
effort to fix.

Change-Id: I82b5bec3ed9686f28aedbe283818af792b96daf4
2026-02-03 22:04:41 +00:00
Aidan MacDonald
1a33d7990a Remove Meizu M3/M6SL/M6SP and Samsung YP-S3 ports
These targets haven't seen any changes since 2008-09
have bitrotted to the point they don't compile anymore.
With only internal NAND flash for storage which doesn't
seem to have ever been accessible from Rockbox, they've
never been usable and there's probably not much point
keeping them around any more.

Change-Id: I2fc63da20682b439126672065ae013044cb2d1c4
2026-02-03 16:32:56 +00:00
Aidan MacDonald
78542df466 Nuke GDB stub
It looks like the GDB stub only ever worked for the Archos
Recorder and iRiver IFP-7xx, neither of which are in-tree
any more.

Change-Id: If1910675b88b4707d26df9bc095818902af2d25b
2026-02-03 10:55:53 +00:00
Aidan MacDonald
ad9471be3b echoplayer: add shadow framebuffer to avoid tearing
Using a simple memcpy to a separate framebuffer prevents
objectionable levels of flickering caused by scanning out
the main framebuffer while it's modified between updates.

With optimized memcpy, copying the whole framebuffer takes
about 260us at maximum CPU+bus frequency. Using DMA would
likely be a bit faster and more power-efficient, but that
can be left as a future optimization.

Change-Id: Ia6dc36d797cdb7a5f6663078c0ecce661267bedf
2026-02-01 10:18:20 -05:00
Aidan MacDonald
d15bb5f848 stm32h7: move LCD framebuffer to AXI SRAM
Framebuffer access consumes a lot of SDRAM bandwidth.
Moving it to AXI SRAM should be a big improvement as
it's around 8x faster (2x clock speed, 4x bus width).

Also take advantage of explicitly assigning sections
to the special :NONE segment, which means they will
not appear in any ELF program header and thus aren't
visible to the bootloader. They can then overlap
areas used by the bootloader -- by the time they're
written, the bootloader will be long gone -- making
it easier to make efficient use of SRAM.

Change-Id: I2392fd23b17472cc08dc5fe4556f6def3cc186ed
2026-01-27 10:04:59 -05:00
Aidan MacDonald
2b09078b92 stm32h7: set 8-byte alignment on main and irq stack
Explicitly set 8-byte alignment as per the AAPCS, which
says the stack should be 8-byte aligned at a public ABI
boundary.

Change-Id: Ie60b664718119ea576e7c6b5efaac011eb907531
2026-01-27 13:31:12 +00:00
Solomon Peachy
e1d10c938a config: Targets must opt-in to bootloader USB storage support
ie by only using HAVE_BOOTLOADER_USB_MODE, instead of blanket-enabling
USB_ENABLE_STORAGE for numerous SoC families

Change-Id: Ief433a1d693876072779e714883438c0012ba2e0
2026-01-27 07:36:40 -05:00
Solomon Peachy
33678c6c3c s3c2440: Fix some compilation failures in the mini2440 bootloader
This whole platform has bitrotten, may be prudent to just nuke it.

Change-Id: Ia12e7ebc160484e57a74dd689d6095d22f3dbfd9
2026-01-27 07:11:32 -05:00
mojyack
1951c17e0b pass event data to usb_acknowledge
add second argument to usb_acknowledge.
it can be used for more appropriate connection tracking that does not
rely on timeout in the future.

Change-Id: I8a44366b7c7a1f944524c4ba8ecd6d9673746a65
2026-01-26 19:47:09 -05:00
Aidan MacDonald
21ba79d431 echoplayer: disable parts of system_init() for application
Most of system_init() should only be performed once after
reset, and is not safe to re-run when the bootloader jumps
to the application.

Change-Id: I4d2e804ce4884da13b9167ddcda860ef3b5ba7d0
2026-01-25 14:12:29 -05:00
Aidan MacDonald
98990df08f stm32h7: update linker scripts for ELF boot
Use flash & AXI SRAM for the bootloader, ITCM/DTCM and
SDRAM for Rockbox. Hardly the most optimal use of SRAMs
but it's good enough to get started.

Fixes the Echo R1 app build, which wasn't fitting in
AXI SRAM.

Change-Id: I4f7e5f618d27b553e5ff8dec1d5c4c61ac9d8eb0
2026-01-25 08:48:44 -05:00
Aidan MacDonald
174b33cc07 stm32h7: rename startup code .init.text section to .init
Do this for compatibility with INIT_ATTR, which uses the
.init section.

Change-Id: I473c29e3d38e5d5a563c98fc910d725024072735
2026-01-25 08:47:44 -05:00
Aidan MacDonald
bd73e0dd42 stm32h7: do bss/data setup in crt0 for bootloader only
Change-Id: I67798a4370b01127364c40328549a6d3081545cf
2026-01-25 07:47:32 -05:00
Aidan MacDonald
e3bf9210ab echoplayer: disable boot data
The current bootdata mechanism won't work well for
ELF binaries so disable it.

Change-Id: If6721ef88a38af76711bbdc6b561529dc3b33557
2026-01-25 07:47:22 -05:00
Aidan MacDonald
721bfac475 echoplayer: don't wake LCD automatically in bootloader
Normally the bootloader won't enable the LCD, but we
still want to call lcd_init() at startup to keep the
code simple.

Change-Id: I866ecd7c81b6c5e6acdd57f5d7680400df3f54f4
2026-01-24 14:05:21 -05:00
Aidan MacDonald
1afa2ca50d echoplayer: implement LCD enable and shutdown
This also gets rid of the long startup delays which were
leftovers from debugging.

Change-Id: Iee9fec1fb210a006a1af53bf47535d7ba2ffa904
2026-01-24 14:02:57 -05:00
Aidan MacDonald
025d641d1f echoplayer: detect boot reason during system_init
Change-Id: I6fdc16e7476044b43e11d3f63d971bd8de860c58
2026-01-24 14:02:26 -05:00
Aidan MacDonald
86c975ee88 echoplayer: set cpu_power_on pin high as early as possible
Change-Id: I6b7343cc81973c4c0a14396b2ecd622fc1c65d30
2026-01-24 13:02:03 -05:00
Aidan MacDonald
319fdcc506 echoplayer: implement reboot using RTC_OUT pin
Change-Id: Ibeda362030c2885abe1366fb3256e925ea27538c
2026-01-24 13:01:56 -05:00
Aidan MacDonald
65b97917ca echoplayer: replace stm32 clock init with target specific init
Change-Id: Ib858f95b4cedba261ea669d3339ea1497e970982
2026-01-24 08:09:42 -05:00
Aidan MacDonald
eea0c128f4 echoplayer: move system_init() out of generic stm32 code
With only one target, it doesn't make sense to have a
common system_init() yet.

Change-Id: I0f6d37709d60bb309fb16ecb9b0870297a189cc4
2026-01-24 08:08:40 -05:00
Aidan MacDonald
386be9dfcc stm32h7: refactor and simplify clock helper functions
The clock helpers are only used for leaf clocks of single
peripherals, which don't benefit from reference counting.

Change-Id: Ica5685e7bc0fce621ae46f758f0ad0b1dcfb2789
2026-01-24 08:07:25 -05:00
Aidan MacDonald
9471cec2ab stm32h7: make cache initialization function public
Change-Id: I460887977f18bfb411d33b6d4efc24ac04cb4050
2026-01-24 08:04:34 -05:00
Aidan MacDonald
62332841cf stm32h7: refactor systick code
Make systick setup less hardcoded, and create a public API
for use by targets, in preparation for moving system_init()
into target-specific code.

Improve the implementation of udelay to make it more robust
against timer wraparound.

Change-Id: I21bb8821cfd1d7e4049fac6e6a4548d80a4276f7
2026-01-24 08:03:50 -05:00
mojyack
5af0a50031 arm: pp: usb-fw-pp502x: remove hack in usb_attach()
not only is this unnecessary, but it causes a bus reset on certain iPod
docks.

Change-Id: I2c2cbf3e5660d0cf25fc6ff4367c23396c521a3f
2026-01-24 07:25:59 -05:00
Aidan MacDonald
80fec463df stm32h7: panic on sdmmc FIFO or DMA errors
FIFO errors shouldn't be possible with hardware flow
control enabled. DMA errors shouldn't occur unless a
bad memory address was passed.

Don't bother checking for ITCM/DTCM in the transfer
setup and instead just wait for the IDMATE error; if
the RM0433 reference manual is to be believed then
SDMMC1 _only_ has access to AXI bus memories, and
checking for all invalid destinations would be very
verbose.

Change-Id: I2b22b56009933e16c5adde4d36b7a906cee57791
2026-01-23 17:47:46 -05:00
Aidan MacDonald
a74ee4c04f sdm32h7: enable sdmmc hardware flow control
Hardware flow control prevents FIFO underruns/overruns
by stopping the bus clock if one would occur. This can
slow down transfers, but that's better than having data
transfer fail due to AXI/AHB bus contention.

Change-Id: I8696d3aff78c17dbbe85907160fa37fd4ee11e85
2026-01-23 17:47:27 -05:00
Aidan MacDonald
5442622d88 arm: fix Cortex-M IRQ masking
The following inline assembly in set_irq_level() turned out
to have incorrect constraints:

    int newvalue = /* input parameter */;
    int oldvalue;

    asm volatile ("mrs %0, primask\n"
                  "msr primask, %1\n"
                  : "=r"(oldvalue) : "r"(newvalue));

leading to incorrect code generation for common cases like
disable_irq_save(), which compiles to:

    mov r5, #1
    mrs r5, primask
    msr primask, r5

...which doesn't disable IRQs at all, since both of the
operands got assigned to the same register; the write of
'oldvalue' clobbers the 'newvalue' input before it's used.

Apparently GCC assumes that input operands are read before
output operands are written. One way to fix this is adding
the '&' constraint: "=&r"(oldvalue), but it's better to
break things down into separate, simpler asm statements
which GCC can figure out itself.

Also add compiler memory barriers where primask is modified
to ensure loads/stores aren't incorrectly moved outside of
critical sections.

While here, optimize disable_irq_save() a bit by using the
cpsid instruction, which avoids the extra "mov" and register
allocation needed by "msr primask".

Change-Id: Iac94a76db5bac399a1cf028da4241a0473259a46
2026-01-23 16:47:46 -05:00
Aidan MacDonald
17faa6abc7 stm32h743: fix 'make zip' error caused by config header
Change-Id: I12521cbfdab3c768015f4eafdfe95adf81ba520a
2026-01-23 16:21:57 +00:00
Solomon Peachy
476d23ac3a Fix red in 7e31f2a6d5
While the binary firmware build succeeded, the 'make zip' process failed
because the script that put the default wps image together runs the
device config header through CPP while only looking into the
configuration header directory.

So move the imx233-config.h header out of the target/arm/imx233 and into
export/config where everything is copacetic.

Change-Id: I9914558a892f8ff7ad839818f0a5ef687cc7b997
2026-01-19 13:49:51 -05:00
Aidan MacDonald
7e31f2a6d5 imx233: move SoC-specific config symbols to separate header
Change-Id: Id044c59045712f1b96b93b5a93b07ddaa46bab7c
2026-01-19 12:47:57 -05:00
Solomon Peachy
d1c3e3b08b Partial revert of 04c45933e
mmc_sleepnow() was accidentally removed from the imx233 sdmmc code,
causing the sansa fuze+ build to fail.

Change-Id: I935f7f4fe99e7353a84dc26e81d85ee55afa0de3
2026-01-13 19:42:34 -05:00
Aidan MacDonald
bc32d43c17 echoplayer: add charger detection and USB current limit setting
Note that USB current limiting is more or less wishful
thinking; only the charge current is limited, but the
system could easily draw more than 100 mA by itself.

Change-Id: I1083b015f0abea5a39a602ca8d7b142d3613b46b
2026-01-13 17:00:12 -05:00
Aidan MacDonald
04c45933e8 firmware: get rid of unused "xxx_sleep()" storage driver function
storage_sleepnow() is the one that is actually implemented
by storage drivers. storage_sleep() sends a Q_STORAGE_SLEEP
event to the storage thread, which will normally end up
calling the driver's sleepnow() function.

Change-Id: Ib6523073348431dcc75c0f10ef99060c6960efd8
2026-01-13 16:59:39 -05:00
Aidan MacDonald
450687bc3d stm32h743: fix incorrectly defined SRAM3 size
Change-Id: Ia31e22fb2c6e7becf380abf440b03a73ec383582
2026-01-13 13:42:51 -05:00
Aidan MacDonald
adb5e2e44f arm: handle unaligned addresses in Cortex-M cache ops
For commit-type operations it's useful to be able to pass
unaligned addresses, so round the address/size to ensure
all cache lines in the address range are hit.

Change-Id: Ibb23050ecf11b6ef6ab1dd517990a68ef62ecfa9
2026-01-13 16:20:45 +00:00
Aidan MacDonald
55f2e2d5d5 echoplayer: fix incorrect loop bounds in lcd_update_rect()
Change-Id: I96b3d235db4a988374967131caba0344c655e5d3
2026-01-12 19:41:08 -05:00
mojyack
3dff77460d usb: arc: fix unable to receive 64 bytes long control packet
by adding QH_ZLT_SEL to control endpoints

Change-Id: I27ccf6a6db302688f1df2e6fd1d3fe98c20323cf
2026-01-12 16:59:34 -05:00
Aidan MacDonald
97dce282b4 echoplayer: add USB support
Enable high speed USB for the Echo R1. Includes reasonably
complete support for full speed USB on the STM32H743 since
that was necessary to debug why it wasn't working at first
(which turned out to be a bug in memcpy, not a hardware or
driver issue).

Change-Id: Ie713195b22ba88c79b9b0d6eb289cb9ccd2763c2
2026-01-12 19:13:23 +00:00
Aidan MacDonald
671320b5d1 echoplayer: implement basic power-on / power-off logic
Use cpu_power_on as a GPIO to keep the main power supply
enabled when running from battery.

Change-Id: Ic79283a0cc640585a0297e11f9dcc2264ec9af26
2026-01-12 13:01:35 -05:00
Aidan MacDonald
d15ccd771d echoplayer: add function to enable 1V8 regulator
This supply is shared by the USB PHY and the audio codec,
so it needs to be reference counted to allow them to be
powered up & down independently (and not just leave the
1V8 regulator enabled all the time).

Change-Id: Ib99b41c2a94b9f0c378153b33c6f91b4370ee998
2026-01-10 21:29:23 +00:00
Aidan MacDonald
047871c58a stm32h7: detect unsupported SDMMC transfers to ITCM
Change-Id: I4916829155d334148bf9683a9a66a125ef90a1f4
2026-01-10 10:06:57 -05:00
Sebastian Leonhardt
873163c671 iMX233 RTC init: make clock source (32kHz/24MHz) explicit for targets
Change-Id: Ib4fa56ad8ee28f3799b6c6c3c058d156353dd15c
2026-01-08 13:48:44 -05:00
Vencislav Atanasov
e3372f495e Add a dummy nand_get_info for ipodnano3g and ipodnano4g
All non-simulator and non-hostfs targets are required to implement storage_get_info() since 04dc052a

Change-Id: I87febd12e101797d9cbbffc0e2e46efc2dace9da
2026-01-08 10:12:51 -05:00
Aidan MacDonald
6a8989f347 echoplayer: enable SD card using sdmmc_host
Enable pullups on SDMMC CMD/DATx lines and set output
speed to medium. Using HIGH and VERYHIGH speeds seems
to cause data corruption, with frequent CRC failures.

Change-Id: I732d19e03a2a857453755b68b6749497eafaef70
2026-01-04 10:27:15 -05:00