dts: arm: Introduce st/mem.h for FLASH & SRAM sizes

As there can be a large number of FLASH & SRAM sizes for the same SoC
having a dts/dtsi for each one would be extremely painful.  Lets just
use some #defines to set that FLASH & SRAM sizes based on the SoC that
is being built.

Change-Id: I06388ada4e49ed3d576da31150288512bb6b4485
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-04-04 10:32:41 -05:00
commit 6422cabd87
4 changed files with 26 additions and 12 deletions

View file

@ -11,14 +11,6 @@
model = "STMicroelectronics STM32L476RG-NUCLEO board";
compatible = "st,stm32l476rg-nucleo", "st,stm32l476";
sram0: memory {
reg = <0x20000000 0x18000>;
};
flash0: flash {
reg = <0x08000000 0x100000>;
};
chosen {
zephyr,console = &usart2;
zephyr,sram = &sram0;

13
dts/arm/st/mem.h Normal file
View file

@ -0,0 +1,13 @@
#ifndef __DT_BINDING_ST_MEM_H
#define __DT_BINDING_ST_MEM_H
#if defined(CONFIG_SOC_STM32F103XB)
#define DT_FLASH_SIZE 0x20000
#define DT_SRAM_SIZE 0x5000
#elif defined(CONFIG_SOC_STM32L476XX)
#define DT_FLASH_SIZE 0x100000
#define DT_SRAM_SIZE 0x18000
#else
#endif
#endif /* __DT_BINDING_ST_MEM_H */

View file

@ -5,14 +5,15 @@
*/
#include <arm/armv7-m.dtsi>
#include <st/mem.h>
/ {
sram0: memory {
reg = <0x20000000 0x5000>;
flash0: flash {
reg = <0x08000000 DT_FLASH_SIZE>;
};
flash0: flash {
reg = <0x08000000 0x20000>;
sram0: memory {
reg = <0x20000000 DT_SRAM_SIZE>;
};
clocks {

View file

@ -5,8 +5,16 @@
*/
#include <arm/armv7-m.dtsi>
#include <st/mem.h>
/ {
flash0: flash {
reg = <0x08000000 DT_FLASH_SIZE>;
};
sram0: memory {
reg = <0x20000000 DT_SRAM_SIZE>;
};
clocks {
clk_hse: clk-hse {