soc: nios2: Cleanup linker scripts to use new DTS macros

Move defines for _RAM_ADDR, _RAM_SIZE, _ROM_ADDR, and _ROM_ADDR into
the linker.ld and thus remove dts_fixup.h.  We rework to use
DT_REG_ADDR and DT_REG_SIZE on DT_CHOSEN(zephyr_sram) and
DT_CHOSEN(zephyr_flash).

Also fixup use of _RAM_ADDR/_RAM_SIZE in newlib/libc-hooks.c.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/lib/libc/newlib/libc-hooks.c b/lib/libc/newlib/libc-hooks.c
index 7bde8ce..89712bc 100644
--- a/lib/libc/newlib/libc-hooks.c
+++ b/lib/libc/newlib/libc-hooks.c
@@ -42,8 +42,10 @@
 #define MAX_HEAP_SIZE (PHYS_RAM_SIZE - USED_RAM_SIZE)
 #elif CONFIG_NIOS2
 #include <layout.h>
-#define USED_RAM_SIZE  (USED_RAM_END_ADDR - _RAM_ADDR)
-#define MAX_HEAP_SIZE (_RAM_SIZE - USED_RAM_SIZE)
+#define RAM_ADDR DT_REG_ADDR(DT_CHOSEN(zephyr_sram))
+#define RAM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_sram))
+#define USED_RAM_SIZE  (USED_RAM_END_ADDR - RAM_ADDR)
+#define MAX_HEAP_SIZE (RAM_SIZE - USED_RAM_SIZE)
 #elif CONFIG_RISCV
 #include <soc.h>
 #define USED_RAM_SIZE  (USED_RAM_END_ADDR - RISCV_RAM_BASE)
diff --git a/soc/nios2/nios2-qemu/dts_fixup.h b/soc/nios2/nios2-qemu/dts_fixup.h
deleted file mode 100644
index a9950c3..0000000
--- a/soc/nios2/nios2-qemu/dts_fixup.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#define _RAM_ADDR				CONFIG_SRAM_BASE_ADDRESS
-
-#define _RAM_SIZE				(CONFIG_SRAM_SIZE * 1024)
-
-#define _ROM_ADDR				CONFIG_FLASH_BASE_ADDRESS
-
-#define _ROM_SIZE				(CONFIG_FLASH_SIZE *1024)
diff --git a/soc/nios2/nios2-qemu/linker.ld b/soc/nios2/nios2-qemu/linker.ld
index 7f2b501..ffc7b93 100644
--- a/soc/nios2/nios2-qemu/linker.ld
+++ b/soc/nios2/nios2-qemu/linker.ld
@@ -10,4 +10,11 @@
 
 #include <layout.h>
 #include <devicetree.h>
+
+#define _RAM_ADDR	DT_REG_ADDR(DT_CHOSEN(zephyr_sram))
+#define _RAM_SIZE	DT_REG_SIZE(DT_CHOSEN(zephyr_sram))
+
+#define _ROM_ADDR	DT_REG_ADDR(DT_CHOSEN(zephyr_flash))
+#define _ROM_SIZE	DT_REG_SIZE(DT_CHOSEN(zephyr_flash))
+
 #include <arch/nios2/linker.ld>
diff --git a/soc/nios2/nios2f-zephyr/dts_fixup.h b/soc/nios2/nios2f-zephyr/dts_fixup.h
deleted file mode 100644
index a9950c3..0000000
--- a/soc/nios2/nios2f-zephyr/dts_fixup.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: Apache-2.0 */
-
-#define _RAM_ADDR				CONFIG_SRAM_BASE_ADDRESS
-
-#define _RAM_SIZE				(CONFIG_SRAM_SIZE * 1024)
-
-#define _ROM_ADDR				CONFIG_FLASH_BASE_ADDRESS
-
-#define _ROM_SIZE				(CONFIG_FLASH_SIZE *1024)
diff --git a/soc/nios2/nios2f-zephyr/linker.ld b/soc/nios2/nios2f-zephyr/linker.ld
index 7f2b501..ffc7b93 100644
--- a/soc/nios2/nios2f-zephyr/linker.ld
+++ b/soc/nios2/nios2f-zephyr/linker.ld
@@ -10,4 +10,11 @@
 
 #include <layout.h>
 #include <devicetree.h>
+
+#define _RAM_ADDR	DT_REG_ADDR(DT_CHOSEN(zephyr_sram))
+#define _RAM_SIZE	DT_REG_SIZE(DT_CHOSEN(zephyr_sram))
+
+#define _ROM_ADDR	DT_REG_ADDR(DT_CHOSEN(zephyr_flash))
+#define _ROM_SIZE	DT_REG_SIZE(DT_CHOSEN(zephyr_flash))
+
 #include <arch/nios2/linker.ld>