From edeb45f8c588a76ca37cba83013fa37e1786b6f3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 7 Mar 2013 14:27:47 +0000 Subject: [PATCH] More kernel build fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5716 42af7a65-404d-4744-a932-0658087f49c3 --- arch/arm/src/armv6-m/up_svcall.c | 6 +++--- arch/arm/src/armv7-m/up_mpu.c | 19 +++++++++---------- arch/arm/src/armv7-m/up_svcall.c | 6 +++--- arch/arm/src/sam3u/Make.defs | 2 +- arch/mips/src/mips32/up_swint0.c | 6 +++--- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/arm/src/armv6-m/up_svcall.c b/arch/arm/src/armv6-m/up_svcall.c index 9ce7562131..7c2bf0f2c9 100644 --- a/arch/arm/src/armv6-m/up_svcall.c +++ b/arch/arm/src/armv6-m/up_svcall.c @@ -251,7 +251,7 @@ int up_svcall(int irq, FAR void *context) * that there is a saved syscall return address. */ - DEBUGASSERT(rtcb->xcp.sysreturn != NULL && + DEBUGASSERT(rtcb->xcp.sysreturn != 0 && regs[REG_EXC_RETURN] == EXC_RETURN_PRIVTHR); /* Setup to return to the saved syscall return address in @@ -260,7 +260,7 @@ int up_svcall(int irq, FAR void *context) current_regs[REG_PC] = rtcb->xcp.sysreturn; current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - rtcb->xcp.sysreturn = NULL; + rtcb->xcp.sysreturn = 0; /* The return value must be in R0-R1. dispatch_syscall() temporarily * moved the value to R2. @@ -289,7 +289,7 @@ int up_svcall(int irq, FAR void *context) * there is a no saved syscall return address. */ - DEBUGASSERT(rtcb->xcp.sysreturn == NULL && + DEBUGASSERT(rtcb->xcp.sysreturn == 0 && regs[REG_EXC_RETURN] == EXC_RETURN_UNPRIVTHR); /* Setup to return to dispatch_syscall in privileged mode. */ diff --git a/arch/arm/src/armv7-m/up_mpu.c b/arch/arm/src/armv7-m/up_mpu.c index 4bb3f21d98..d4b04a4446 100644 --- a/arch/arm/src/armv7-m/up_mpu.c +++ b/arch/arm/src/armv7-m/up_mpu.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_mpu.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ #include #include +#include #include "mpu.h" #include "up_internal.h" @@ -58,7 +59,7 @@ * regions (0xff), and 0 means all subregions but one (0x00). */ -static const void uint8_t g_regionmap[9] = +static const uint8_t g_regionmap[9] = { 0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00 }; @@ -106,9 +107,10 @@ unsigned int mpu_allocregion(void) uint8_t mpu_log2regionsize(size_t size) { + uint32_t l2size; + /* The minimum permitted region size is 16 bytes (log2(16) = 4. */ - uint32_t l2size; for (l2size = 4; l2size < 32 && size > (1 << l2size); size++); return l2size; } @@ -129,7 +131,7 @@ uint8_t mpu_log2regionsize(size_t size) uint32_t mpu_subregion(size_t size, uint8_t l2size) { - unsigned int nsrs + unsigned int nsrs; uint32_t asize; uint32_t mask; @@ -140,7 +142,7 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size) * l2size: Log2 of the actual region size is <= (1 << l2size); */ - DEBUGASSERT(lsize > 3 && size <= (1 << l2size)); + DEBUGASSERT(l2size > 3 && size <= (1 << l2size)); /* Examples with l2size = 12: * @@ -153,7 +155,7 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size) if (l2size < 32) { - mask = ((1 << lsize)-1) >> 3; /* Shifted mask */ + mask = ((1 << l2size)-1) >> 3; /* Shifted mask */ } /* The 4Gb region size is a special case */ @@ -168,9 +170,6 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size) } asize = (size + mask) & ~mask; /* Adjusted size */ - nsrs = asize >> (lsize-3); /* Number of subregions */ + nsrs = asize >> (l2size-3); /* Number of subregions */ return g_regionmap[nsrs]; } - - - diff --git a/arch/arm/src/armv7-m/up_svcall.c b/arch/arm/src/armv7-m/up_svcall.c index 4da4669348..5b56797a90 100644 --- a/arch/arm/src/armv7-m/up_svcall.c +++ b/arch/arm/src/armv7-m/up_svcall.c @@ -250,7 +250,7 @@ int up_svcall(int irq, FAR void *context) * that there is a saved syscall return address. */ - DEBUGASSERT(rtcb->xcp.sysreturn != NULL && + DEBUGASSERT(rtcb->xcp.sysreturn != 0 && regs[REG_EXC_RETURN] == EXC_RETURN_PRIVTHR); /* Setup to return to the saved syscall return address in @@ -259,7 +259,7 @@ int up_svcall(int irq, FAR void *context) current_regs[REG_PC] = rtcb->xcp.sysreturn; current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; - rtcb->xcp.sysreturn = NULL; + rtcb->xcp.sysreturn = 0; /* The return value must be in R0-R1. dispatch_syscall() temporarily * moved the value to R2. @@ -288,7 +288,7 @@ int up_svcall(int irq, FAR void *context) * there is a no saved syscall return address. */ - DEBUGASSERT(rtcb->xcp.sysreturn == NULL && + DEBUGASSERT(rtcb->xcp.sysreturn == 0 && regs[REG_EXC_RETURN] == EXC_RETURN_UNPRIVTHR); /* Setup to return to dispatch_syscall in privileged mode. */ diff --git a/arch/arm/src/sam3u/Make.defs b/arch/arm/src/sam3u/Make.defs index 58047af21d..1255af237a 100644 --- a/arch/arm/src/sam3u/Make.defs +++ b/arch/arm/src/sam3u/Make.defs @@ -56,7 +56,7 @@ CMN_ASRCS += up_memcpy.S endif ifeq ($(CONFIG_NUTTX_KERNEL),y) -CHIP_CSRCS += up_mpu.c +CMN_CSRCS += up_mpu.c endif ifeq ($(CONFIG_ELF),y) diff --git a/arch/mips/src/mips32/up_swint0.c b/arch/mips/src/mips32/up_swint0.c index 068bd45abf..4a172fe2a6 100644 --- a/arch/mips/src/mips32/up_swint0.c +++ b/arch/mips/src/mips32/up_swint0.c @@ -244,7 +244,7 @@ int up_swint0(int irq, FAR void *context) */ #error "Missing logic -- need to test for privileged mode" - DEBUGASSERT(rtcb->xcp.sysreturn != NULL && ???); + DEBUGASSERT(rtcb->xcp.sysreturn != 0 && ???); /* Setup to return to the saved syscall return address in * unprivileged mode. @@ -252,7 +252,7 @@ int up_swint0(int irq, FAR void *context) current_regs[REG_EPC] = rtcb->xcp.sysreturn; #error "Missing logic -- need to set for unprivileged mode" - rtcb->sysreturn = NULL; + rtcb->sysreturn = 0; } break; #endif @@ -276,7 +276,7 @@ int up_swint0(int irq, FAR void *context) */ #error "Missing logic -- Need to set unprivileged mode" - DEBUGASSERT(rtcb->xcp.sysreturn == NULL && ???); + DEBUGASSERT(rtcb->xcp.sysreturn == 0 && ???); /* Setup to return to dispatch_syscall in privileged mode. */