Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/ostest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ if(CONFIG_TESTING_OSTEST)
endif()

if(CONFIG_SMP)
list(APPEND SRCS smp_call.c)
list(APPEND SRCS smp_call.c intstack.c)
endif()

if(CONFIG_SCHED_EVENTS AND CONFIG_BUILD_FLAT)
Expand Down
1 change: 1 addition & 0 deletions testing/ostest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ endif

ifeq ($(CONFIG_SMP),y)
CSRCS += smp_call.c
CSRCS += intstack.c
endif

ifeq ($(CONFIG_SCHED_EVENTS),y)
Expand Down
81 changes: 81 additions & 0 deletions testing/ostest/intstack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/****************************************************************************
* apps/testing/ostest/intstack.c
*
* SPDX-License-Identifier: Apache-2.0
*
* 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.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

#include <assert.h>
#include <stdio.h>

#include <nuttx/arch.h>
#include <nuttx/sched.h>

#include "ostest.h"

#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT) && \
defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3

/****************************************************************************
* Private Functions
****************************************************************************/

static int intstack_func(FAR void *arg)
{
return OK;
}

/****************************************************************************
* Public Functions
****************************************************************************/

/****************************************************************************
* Name: intstack_test
*
* Description:
* Each CPU takes an interrupt, then its interrupt stack must show some
* use and must still have some of its color. A stack with no color
* reports that all of it is used.
*
****************************************************************************/

void intstack_test(void)
{
size_t used;
int cpu;

for (cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++)
{
nxsched_smp_call_single(cpu, intstack_func, NULL);

used = up_check_intstack(cpu, 0);
printf("intstack_test: CPU %d used %zu of %d\n", cpu, used,
CONFIG_ARCH_INTERRUPTSTACK);
ASSERT(used > 0);
ASSERT(used < CONFIG_ARCH_INTERRUPTSTACK);
}

printf("intstack_test: Test success\n");
}
#endif
4 changes: 4 additions & 0 deletions testing/ostest/ostest.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ void setjmp_test(void);

#ifdef CONFIG_SMP
void smp_call_test(void);

/* intstack.c ***************************************************************/

void intstack_test(void);
#endif

/* spinlock.c ***************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions testing/ostest/ostest_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,12 @@ static int user_main(int argc, char *argv[])
smp_call_test();
#endif

#if defined(CONFIG_SMP) && defined(CONFIG_BUILD_FLAT) && \
defined(CONFIG_STACK_COLORATION) && CONFIG_ARCH_INTERRUPTSTACK > 3
printf("\nuser_main: interrupt stack test\n");
intstack_test();
#endif

#if defined(CONFIG_SCHED_EVENTS) && defined(CONFIG_BUILD_FLAT)
/* Verify nxevent */

Expand Down
Loading