diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 30cbd8b279f..62641b434d2 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -1658,6 +1658,15 @@ config STM32_CCMEXCLUDE and (2) it appears to be impossible to execute ELF modules from CCM RAM. +config STM32_CCM_PROCFS + bool "CCM PROCFS support" + default n + depends on STM32_CCMEXCLUDE && MM_MULTIHEAP && FS_PROCFS + ---help--- + Select to build in support for /proc/ccm. Reading from /proc/ccm + will provide statistics about CCM memory use similar to what you + would get from mallinfo() for the user heap. + config STM32_DMACAPABLE bool "Workaround non-DMA capable memory" depends on ARCH_DMA diff --git a/arch/arm/src/stm32/Make.defs b/arch/arm/src/stm32/Make.defs index 77d6b4c7ef0..f5dd2128916 100644 --- a/arch/arm/src/stm32/Make.defs +++ b/arch/arm/src/stm32/Make.defs @@ -96,7 +96,6 @@ CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c CHIP_CSRCS += stm32_timerisr.c stm32_dma.c stm32_lowputc.c stm32_serial.c CHIP_CSRCS += stm32_spi.c stm32_sdio.c stm32_tim.c stm32_waste.c stm32_ccm.c -CHIP_CSRCS += stm32_procfs_ccm.c ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CHIP_ASRCS += stm32_vectors.S @@ -106,6 +105,10 @@ ifeq ($(CONFIG_NUTTX_KERNEL),y) CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c endif +ifeq ($(CONFIG_STM32_CCM_PROCFS),y) +CHIP_CSRCS += stm32_procfs_ccm.c +endif + ifeq ($(CONFIG_STM32_I2C_ALT),y) CHIP_CSRCS += stm32_i2c_alt.c else diff --git a/arch/arm/src/stm32/stm32_procfs_ccm.c b/arch/arm/src/stm32/stm32_procfs_ccm.c index 68666f46611..d025f9e5ce0 100644 --- a/arch/arm/src/stm32/stm32_procfs_ccm.c +++ b/arch/arm/src/stm32/stm32_procfs_ccm.c @@ -82,14 +82,11 @@ struct ccm_file_s { - struct procfs_file_s base; /* Base open file structure */ - unsigned int linesize; /* Number of valid characters in line[] */ + struct procfs_file_s base; /* Base open file structure */ + unsigned int linesize; /* Number of valid characters in line[] */ char line[CCM_LINELEN]; /* Pre-allocated buffer for formatted lines */ - - /* Add context specific data types for managing an open file here */ }; - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -100,10 +97,8 @@ static int ccm_open(FAR struct file *filep, FAR const char *relpath, static int ccm_close(FAR struct file *filep); static ssize_t ccm_read(FAR struct file *filep, FAR char *buffer, size_t buflen); - static int ccm_dup(FAR const struct file *oldp, FAR struct file *newp); - static int ccm_stat(FAR const char *relpath, FAR struct stat *buf); /**************************************************************************** @@ -124,12 +119,12 @@ const struct procfs_operations ccm_procfsoperations = ccm_open, /* open */ ccm_close, /* close */ ccm_read, /* read */ - NULL, /* write */ + NULL, /* write */ ccm_dup, /* dup */ - NULL, /* opendir */ - NULL, /* closedir */ - NULL, /* readdir */ - NULL, /* rewinddir */ + NULL, /* opendir */ + NULL, /* closedir */ + NULL, /* readdir */ + NULL, /* rewinddir */ ccm_stat /* stat */ }; @@ -294,7 +289,7 @@ static int ccm_dup(FAR const struct file *oldp, FAR struct file *newp) return -ENOMEM; } - /* The copy the file attribtes from the old attributes to the new */ + /* The copy the file attributes from the old attributes to the new */ memcpy(newpriv, oldpriv, sizeof(struct ccm_file_s));