[U-Boot] [PATCH 3/4] arm: debug: import debug files from Linux 3.16

Przemyslaw Marczak
2014-08-25T09:03:13Z

Hello Masahiro,
I tried to test this on Trats2(Exynos4412) with required files from the
linux and the code doesn't build.

On 08/17/2014 08:16 AM, Masahiro Yamada wrote:
> U-Boot does not have arch/arm/kernel, include/uapi directories,
> This commit copies files as follows:
>
> Location in Linux -> Location in U-Boot
>
> arch/arm/kernel/debug.S -> arch/arm/lib/debug.S
> arch/arm/include/debug/8250.S -> arch/arm/include/debug/8250.S
> include/uapi/linux/serial_reg.h -> include/linux/serial_reg.h
>
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
>

> diff --git a/arch/arm/lib/debug.S b/arch/arm/lib/debug.S
> new file mode 100644
> index 0000000..14f7c3b
> --- /dev/null
> +++ b/arch/arm/lib/debug.S
> @@ -0,0 +1,138 @@
> +/*
> + * linux/arch/arm/kernel/debug.S
> + *
> + * Copyright (C) 1994-1999 Russell King
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * 32-bit debugging code
> + */
> +#include <linux/linkage.h>
> +#include <asm/assembler.h>
> +
> + .text
> +
> +/*
> + * Some debugging routines (useful if you've got MM problems and
> + * printk isn't working). For DEBUGGING ONLY!!! Do not leave
> + * references to these in a production kernel!
> + */
> +
> +#if !defined(CONFIG_DEBUG_SEMIHOSTING)
> +#include CONFIG_DEBUG_LL_INCLUDE
> +#endif
> +
> +#ifdef CONFIG_MMU

This config: "CONFIG_MMU" is nowhere defined in the u-boot.
U-boot uses (n)def CONFIG_SYS_DCACHE_OFF - for enable/disable the mmu in
ARM.

But when I do the change like this:
-#ifdef CONFIG_MMU
+#ifndef CONFIG_SYS_DCACHE_OFF

Then I got the data abort, after use a printch(). But without this
change the printch() function works fine (after the uart init).

> + .macro addruart_current, rx, tmp1, tmp2
> + addruart \tmp1, \tmp2, \rx
> + mrc p15, 0, \rx, c1, c0
> + tst \rx, #1
> + moveq \rx, \tmp1
> + movne \rx, \tmp2
> + .endm
> +
> +#else /* !CONFIG_MMU */
> + .macro addruart_current, rx, tmp1, tmp2
> + addruart \rx, \tmp1
Generates build error:
This asm macro: "addruart" gets 3 arguments but in this place got only
two. After fix - works fine.
It's strange, no one use this in the kernel before?

And moreover I think that functions declarations are welcome for this code.

Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com