Skip to content

Commit

Permalink
ARC: boards: nSIM: memory layout overhaul
Browse files Browse the repository at this point in the history
Currently we use incorrect memory layout for SMP boards as
we put data (which need do be accessible from all cores) to
DCCM which is private for each CPU core.

This works for nSIM which doesn't simulate CCMs (as we don't pass
corresponding nSIM options for SMP configurations) however
it won't work if we run that code on real HW (we want to achieve
that nSIM configurations are also runnable on HAPS - FPGA platform).

Let's fix that issue by using DDR instead of CCMs for SMP
configurations (nsim_hs_smp and nsim_hs6x_smp).

While I'm at it - switch UP HS6x configuration (nsim_hs6x)
for DDR usage instead of CCMs - to make that configuration closer
to the HAPS config we have.

Signed-off-by: Eugeniy Paltsev <[email protected]>
Signed-off-by: Evgeniy Paltsev <[email protected]>
  • Loading branch information
evgeniy-paltsev authored and carlescufi committed May 6, 2022
1 parent 3f6be01 commit 38c24cd
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 36 deletions.
40 changes: 40 additions & 0 deletions boards/arc/nsim/nsim-ccm-mem.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2022, Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "skeleton.dtsi"
#include <mem.h>

#ifndef ICCM_ADDR
#define ICCM_ADDR 0
#endif

#ifndef ICCM_SIZE
#define ICCM_SIZE DT_SIZE_M(1)
#endif

#ifndef DCCM_ADDR
#define DCCM_ADDR 80000000
#endif

#ifndef DCCM_SIZE
#define DCCM_SIZE DT_SIZE_M(1)
#endif

/ {
iccm0: iccm@ICCM_ADDR {
compatible = "arc,iccm";
reg = <DT_ADDR(ICCM_ADDR) ICCM_SIZE>;
};

dccm0: dccm@DCCM_ADDR {
compatible = "arc,dccm";
reg = <DT_ADDR(DCCM_ADDR) DCCM_SIZE>;
};

chosen {
zephyr,sram = &dccm0;
};
};
27 changes: 27 additions & 0 deletions boards/arc/nsim/nsim-flat-mem.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2022, Synopsys, Inc. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "skeleton.dtsi"
#include <mem.h>

#ifndef DDR_ADDR
#define DDR_ADDR 80000000
#endif

#ifndef DDR_SIZE
#define DDR_SIZE DT_SIZE_M(1)
#endif

/ {
ddr0: memory@DDR_ADDR {
device_type = "memory";
reg = <DT_ADDR(DDR_ADDR) DDR_SIZE>;
};

chosen {
zephyr,sram = &ddr0;
};
};
27 changes: 0 additions & 27 deletions boards/arc/nsim/nsim.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@
#include "skeleton.dtsi"
#include <mem.h>

#ifndef ICCM_ADDR
#define ICCM_ADDR 0
#endif

#ifndef ICCM_SIZE
#define ICCM_SIZE DT_SIZE_K(1024)
#endif

#ifndef DCCM_ADDR
#define DCCM_ADDR 80000000
#endif

#ifndef DCCM_SIZE
#define DCCM_SIZE DT_SIZE_K(1024)
#endif

/ {
cpus {
#address-cells = <1>;
Expand All @@ -37,16 +21,6 @@
};
};

iccm0: iccm@ICCM_ADDR {
compatible = "arc,iccm";
reg = <DT_ADDR(ICCM_ADDR) ICCM_SIZE>;
};

dccm0: dccm@DCCM_ADDR {
compatible = "arc,dccm";
reg = <DT_ADDR(DCCM_ADDR) DCCM_SIZE>;
};

uart0: uart@f0000000 {
compatible = "ns16550";
clock-frequency = <50000000>;
Expand All @@ -58,7 +32,6 @@
};

chosen {
zephyr,sram = &dccm0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
};
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_em.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-ccm-mem.dtsi"

/ {
cpus {
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_hs.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-ccm-mem.dtsi"

/ {
model = "snps,nsim_hs";
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_hs6x.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-flat-mem.dtsi"

/ {
model = "snps,nsim_hs";
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_hs6x_smp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-flat-mem.dtsi"

/ {
model = "snps,nsim_hs";
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_hs_mpuv6.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-ccm-mem.dtsi"

/ {
model = "snps,nsim_hs";
Expand Down
1 change: 1 addition & 0 deletions boards/arc/nsim/nsim_hs_smp.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/dts-v1/;

#include "nsim.dtsi"
#include "nsim-flat-mem.dtsi"

/ {
model = "snps,nsim_hs";
Expand Down
3 changes: 0 additions & 3 deletions soc/arc/snps_nsim/Kconfig.defconfig.hs6x
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ config NUM_IRQS
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 50000000

config HARVARD
default y

config CACHE_MANAGEMENT
default y

Expand Down
3 changes: 0 additions & 3 deletions soc/arc/snps_nsim/Kconfig.defconfig.hs6x_smp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
config CACHE_MANAGEMENT
default y

config HARVARD
default y

config ARC_CONNECT
default y

Expand Down
3 changes: 0 additions & 3 deletions soc/arc/snps_nsim/Kconfig.defconfig.hs_smp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
# SMP simulation is slower than single core, 1 Mhz seems reasonable match with wallclock
default 1000000

config HARVARD
default y

config ARC_FIRQ
default y

Expand Down
6 changes: 6 additions & 0 deletions soc/arc/snps_nsim/linker.ld
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,10 @@
#define DCCM_SIZE DT_REG_SIZE(DT_INST(0, arc_dccm))
#endif

/* SRAM - memory available for all cores in cluster. Can be used for both instructions and data */
#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_sram), reg) && (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) > 0)
#define SRAM_START DT_REG_ADDR(DT_CHOSEN(zephyr_sram))
#define SRAM_SIZE DT_REG_SIZE(DT_CHOSEN(zephyr_sram))
#endif

#include <arch/arc/v2/linker.ld>

0 comments on commit 38c24cd

Please sign in to comment.