From c773230a9ba238789f4e3b4846e9de2ee70c2985 Mon Sep 17 00:00:00 2001 From: DrDoof <8052722+DrDoof@users.noreply.github.com> Date: Sun, 4 Oct 2026 19:12:24 +0200 Subject: [PATCH] Bring back the definition of strcpy 494320b removed strcpy() from rtl837x_flash.c but left its declaration in rtl837x_common.h. Since then the linker has taken strcpy from the SDCC library instead, which expects the destination as a generic pointer in DPL, DPH and B. The callers pass an __xdata pointer and leave B as it is, so the copy lands wherever B happens to point. boot.c only gets away with it because B is zero there; a call with B set, as from the ChaCha20 test in #207, writes into internal RAM and stops the 8051. --- rtlplayground.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rtlplayground.c b/rtlplayground.c index 35ca4c5e..916984f1 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -410,6 +410,16 @@ uint16_t strlen_x(__xdata const char *s) } +uint16_t strcpy(__xdata uint8_t *dst, const char *s) +{ + __xdata uint8_t *b = dst; + while (*s) + *dst++ = *s++; + *dst = 0; + return dst - b; +} + + char strcmp(__xdata const uint8_t *a, __code const uint8_t *b) { uint8_t i = 0;