
On 24.09.2018 19:55, Max Filippov wrote:
On Sun, Sep 23, 2018 at 1:02 PM, Daniel Schwierzeck daniel.schwierzeck@gmail.com wrote:
Create a new Kconfig menu called 'Standalone programs' with 'Program load address' as menu entry. It's possible now to build without the standalone example. Anyway the default value for CONFIG_STANDALONE is 'y' to maintain the current behavior.
Signed-off-by: Daniel Schwierzeck daniel.schwierzeck@gmail.com
[...]
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 2ba7132c20..e228f15660 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -8,6 +8,9 @@ config SYS_ARCH config SYS_CPU string "Xtensa Core Variant"
+config STANDALONE_LOAD_ADDR
default 0x00800000
This doesn't preserve current address assignment for xtensa XTFPGA boards:
--- a/include/configs/xtfpga.h +++ b/include/configs/xtfpga.h @@ -74,22 +74,6 @@ #define CONFIG_SYS_MEMTEST_START MEMADDR(0x01000000) #define CONFIG_SYS_MEMTEST_END MEMADDR(0x02000000)
-/* Load address for stand-alone applications.
- MEMADDR cannot be used here, because the definition needs to be
- a plain number as it's used as -Ttext argument for ld in standalone
- example makefile.
- Handle noMMU vs MMUv2 vs MMUv3 distinction here manually.
- */
-#if XCHAL_HAVE_PTP_MMU -#if XCHAL_VECBASE_RESET_VADDR == XCHAL_VECBASE_RESET_PADDR -#define CONFIG_STANDALONE_LOAD_ADDR 0x00800000 -#else -#define CONFIG_STANDALONE_LOAD_ADDR 0xd0800000 -#endif -#else -#define CONFIG_STANDALONE_LOAD_ADDR 0x60800000 -#endif
OTOH I don't see any way to express this in Kconfig.
I see you set the SYS_CPU string manually. I think this is error-prone and not user-friendly. I suggest to convert this to Kconfig symbols like this:
config SYS_CPU default "dc232b" if CPU_DC232B default "dc233c" if CPU_DC233C default "de212" if CPU_DE212
choice prompt "Xtensa Core Variant" default CPU_DC233C
config CPU_DC232B bool "dc232b"
config CPU_DC233C bool "dc233c"
config CPU_DE212 bool "de212"
endchoice
Then the user can only choose between the three supported cores and SYS_CPU will be automatically updated. The default value for STANDALONE_LOAD_ADDR could be set like this:
config STANDALONE_LOAD_ADDR default 0xd0800000 if CPU_DC232B default 0x00800000 if CPU_DC233C default 0x60800000 if CPU_DE212
Alternatively you model the MMU configuration also as Kconfig symbol which can be selected by those CPU_* symbols. Then you set the default value of STANDALONE_LOAD_ADDR dependent on that MMU setting. What do you think?