mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
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.
This commit is contained in:
1 parent
0e9c997d06
commit
c773230a9b
1 file changed
+10
@@ -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)
|
char strcmp(__xdata const uint8_t *a, __code const uint8_t *b)
|
||||||
{
|
{
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user