/**************************************************************************** * boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.mem * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The * ASF licenses this file to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * ****************************************************************************/ #include /* Memory layout for ld-protected.script and ld-userland.script * * |-CONFIG_RAM_START * | |-CONFIG_NUTTX_USERSPACE * +--------+----------+--------+--------+ * | kflash | uflash | ksram | usram | * +--------+----------+--------+--------+ * |>-- FLASH_SIZE ---<|>-- SRAM_SIZE --<| * */ #define KFLASH_ADDR (CONFIG_RAM_START) #define UFLASH_ADDR (CONFIG_NUTTX_USERSPACE) #define KFLASH_SIZE (UFLASH_ADDR - KFLASH_ADDR) #define UFLASH_SIZE (KFLASH_SIZE) #define FLASH_SIZE (0x100000) /* needs be POT */ #define SRAM_SIZE (0x200000) /* needs be POT */ #if KFLASH_SIZE < 0 #error "Invalid KFLASH_SIZE!" #endif #if KFLASH_SIZE + UFLASH_SIZE > FLASH_SIZE #error "Adjust FLASH_SIZE please!" #endif #if CONFIG_RAM_SIZE < FLASH_SIZE + SRAM_SIZE #error "CONFIG_RAM_SIZE too small?" #endif #define KSRAM_SIZE (SRAM_SIZE / 2) #define USRAM_SIZE (SRAM_SIZE - KSRAM_SIZE) #define KSRAM_ADDR (KFLASH_ADDR + FLASH_SIZE) #define USRAM_ADDR (KSRAM_ADDR + KSRAM_SIZE) MEMORY { kflash (rx) : ORIGIN = KFLASH_ADDR, LENGTH = KFLASH_SIZE uflash (rx) : ORIGIN = UFLASH_ADDR, LENGTH = UFLASH_SIZE ksram (rwx) : ORIGIN = KSRAM_ADDR, LENGTH = KSRAM_SIZE usram (rwx) : ORIGIN = USRAM_ADDR, LENGTH = USRAM_SIZE }