From 3ace1ddd76b9c04f3ed23883de6279b4485612e8 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 29 May 2023 21:31:09 +0300 Subject: start trying to boot on visionfive 2 + Not bootable quite yet. Among other things, I couldn't get the current starfive u-boot fork to boot, so try adding support for booting with precompiled u-boot via the `go` command. Initial testing with qemu shows that this should be possible, and if it works, might be useful in the (far) future with other slightly janky SBCs. Also, NS16550 is 8250-based, and I'm really only using the base 8250, so rename and add visionfive 2 uart to list of compatibles. Visionfive 2 is still completely untested. --- include/kmi/debug.h | 4 ++-- include/kmi/string.h | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/kmi/debug.h b/include/kmi/debug.h index deca4ca..4079048 100644 --- a/include/kmi/debug.h +++ b/include/kmi/debug.h @@ -320,8 +320,8 @@ #if defined(DEBUG) /** Serial devices supported. */ enum serial_dev { - /** NS16550A and compatible. Currently the only supported serial device. */ - NS16550A, + /** 8250 and compatible. Currently the only supported serial device. */ + UART_8250, }; /** diff --git a/include/kmi/string.h b/include/kmi/string.h index 2b26a2d..f72299b 100644 --- a/include/kmi/string.h +++ b/include/kmi/string.h @@ -215,6 +215,21 @@ void *memmove(void *dst, const void *src, size_t num); */ int memcmp(const void *ptr1, const void *ptr2, size_t num); +/** + * Try to convert string \p s into a corresponding + * \c uintptr_t. Handles decimal, octal and hex, + * assuming hex starts with \c 0x or \c 0X and octal with + * \c 0, otherwise assumes decimal. Allows \c + and \c - in + * decimal. + * + * Note that u-boot likes to skip leading \c 0x when using hex, + * so if you're passing u-boot variables make sure to check prefixes. + * + * @param s String to convert to pointer. + * @return Corresponding pointer value. + */ +uintptr_t strtouintptr(const char *s); + /* Honorable mentions: * * char *strerror(int err); -- cgit v1.3