Skip to content

Commit

Permalink
Merge pull request #9 from viv-eth/vivianep/chimera-target
Browse files Browse the repository at this point in the history
[targets] Add Chimera as target platform
  • Loading branch information
viv-eth authored Nov 15, 2024
2 parents 8d81342 + cd6af2d commit 50a5eb8
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
14 changes: 13 additions & 1 deletion targets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@
# SPDX-License-Identifier: Apache-2.0
#
# Moritz Scherer <[email protected]>
# Viviane Potocnik <[email protected]>

set(AVAILABLE_TARGETS
"cheshire"
"chimera-open"
CACHE STRING "Available Targets"
)

get_property(OPT_STRINGS CACHE OPT PROPERTY STRINGS)

add_target_source(${TARGET_PLATFORM})
if(NOT TARGET_PLATFORM IN_LIST AVAILABLE_TARGETS)
message(FATAL_ERROR "Wrong value for TARGET_PLATFORM: Got ${TARGET_PLATFORM}. Available targets are: ${AVAILABLE_TARGETS}")
endif()

if (TARGET_PLATFORM STREQUAL "cheshire")
add_subdirectory(cheshire)
endif()

if (TARGET_PLATFORM STREQUAL "chimera-open")
add_subdirectory(chimera-open)
endif()
10 changes: 6 additions & 4 deletions targets/chimera-open/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
# SPDX-License-Identifier: Apache-2.0
#
# Moritz Scherer <[email protected]>
# Viviane Potocnik <[email protected]>

file(GLOB_RECURSE ASM_SOURCES
"src/runtime/crt0.S"
"src/crt0.S"
)

file(GLOB_RECURSE C_SOURCES
"src/*.c"
)

set_property(SOURCE ${ASM_SOURCES} PROPERTY LANGUAGE ASM)
add_library(runtime OBJECT ${ASM_SOURCES} ${C_SOURCES})

set(ISA rv32imc)
set(ABI ilp32)

target_include_directories(runtime
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/include
)

set(ISA rv32imc)
set(ABI ilp32)

target_compile_options(runtime
PUBLIC
-march=${ISA}
Expand Down
10 changes: 7 additions & 3 deletions targets/chimera-open/common.ldh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MEMORY {
/* If more SPM is available, CRT0 repoints the stack. */
extrom (rx) : ORIGIN = 0x00000000, LENGTH = 48K
spm (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
memisl (rwx) : ORIGIN = 0x18000000, LENGTH = 64K
memisl (rwx) : ORIGIN = 0x48000000, LENGTH = 64K
/* We assume at least 8 MiB of DRAM (minimum for Linux). */
dram (rwx) : ORIGIN = 0x80000000, LENGTH = 8M
}
Expand All @@ -28,7 +28,7 @@ SECTIONS {
/* Global and stack pointer */
/* By default, keep the calling context (boot ROM) stack pointer */
__global_pointer$ = ADDR(.misc) + SIZEOF(.misc) / 2;
__stack_pointer$ = ORIGIN(memisl) + LENGTH(memisl);
__stack_pointer$ = __stack_start - 8;

/* Further addresses */
__base_dma = 0x01000000;
Expand All @@ -44,8 +44,12 @@ SECTIONS {
__base_gpio = 0x03005000;
__base_slink = 0x03006000;
__base_vga = 0x03007000;
__base_usb = 0x03008000;
__base_bus_err = 0x03009000;
__base_plic = 0x04000000;
__base_memisl = ORIGIN(memisl);
__base_clic = 0x08000000;
__base_spm = ORIGIN(spm);
__base_dram = ORIGIN(dram);
__base_memisl = ORIGIN(memisl);
__stack_start = ORIGIN(memisl) + LENGTH(memisl);
}
2 changes: 2 additions & 0 deletions targets/chimera-open/link.ld
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
/* Nicole Narr <[email protected]> */
/* Christopher Reinwardt <[email protected]> */
/* Paul Scheffler <[email protected]> */
/* Lorenzo Leone <[email protected]> */


INCLUDE common.ldh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Moritz Scherer <scheremo@iis.ee.ethz.ch>
// Viviane Potocnik <vivianep@iis.ee.ethz.ch>

.section .text._start
// Minimal CRT0
Expand Down

0 comments on commit 50a5eb8

Please sign in to comment.