diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-08 18:36:51 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-08 18:36:51 +0000 |
commit | 2e30a3f65595e997fd3a6648b50a1d07815c39c3 (patch) | |
tree | 827f81e6b55b110a382ba12ed866f3c13fafe1f3 /nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c | |
parent | 6e1fea8b98a48200b12a6e4d304f33d18ba70e89 (diff) | |
download | px4-nuttx-2e30a3f65595e997fd3a6648b50a1d07815c39c3.tar.gz px4-nuttx-2e30a3f65595e997fd3a6648b50a1d07815c39c3.tar.bz2 px4-nuttx-2e30a3f65595e997fd3a6648b50a1d07815c39c3.zip |
Completes implementation of kernel mode build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3483 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c')
-rwxr-xr-x | nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c b/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c index 411fba9b1..2dacd36c8 100755 --- a/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_mpuinit.c @@ -39,6 +39,7 @@ #include <nuttx/config.h> #include <arch/board/user_map.h> +#include "mpu.h" #ifndef CONFIG_NUTTX_KERNEL @@ -46,6 +47,14 @@ * Private Definitions ****************************************************************************/ +#ifndef MAX +# define MAX(a,b) a > b ? a : b +#endif + +#ifndef MIN +# define MIN(a,b) a < b ? a : b +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -69,7 +78,31 @@ void sam3u_mpuinitialize(void) { -# warning "Not implemented" + uintptr_t datastart = MIN(ONFIG_USER_DATADESTSTART, CONFIG_USER_BSSSTART); + uintptr_t dataend = MAX(ONFIG_USER_DATADESTEND, CONFIG_USER_BSSEND); + + DEBUGASSERT(CONFIG_USER_TEXTEND >= CONFIG_USER_TEXTSTART && dataend >= datastart); + + @echo "#define C 0x`grep \" _stext\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define 0x`grep \" _etext$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_DATASOURCE 0x`grep \" _eronly$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define C 0x`grep \" _sdata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_ 0x`grep \" _edata$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define 0x`grep \" _sbss\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + @echo "#define CONFIG_USER_ 0x`grep \" _ebss$\" $(TOPDIR)/User.map | cut -d' ' -f1`" >> $(BOARD_INCLUDE)/user_map.h + + /* Show MPU information */ + + mpu_showtype(); + + /* Configure user flash and SRAM space */ + + mpu_userflash(0, CONFIG_USER_TEXTSTART, CONFIG_USER_TEXTEND - CONFIG_USER_TEXTSTART); + mpu_userintsram(1, datastart, dataend - datastart); + + /* Then enable the MPU */ + + mpu_control(true, false, true); } #endif /* CONFIG_NUTTX_KERNEL */ |