2018-08-27 20:52:02 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* include/nuttx/nuttx.h
|
|
|
|
*
|
2021-01-29 21:39:49 +08:00
|
|
|
* 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
|
2018-08-27 20:52:02 +08:00
|
|
|
*
|
2021-01-29 21:39:49 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2018-08-27 20:52:02 +08:00
|
|
|
*
|
2021-01-29 21:39:49 +08:00
|
|
|
* 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.
|
2018-08-27 20:52:02 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_NUTTX_NUTTX_H
|
|
|
|
#define __INCLUDE_NUTTX_NUTTX_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Name: container_of
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Cast a member of a structure out to get the address of the containing
|
|
|
|
* structure
|
|
|
|
*
|
|
|
|
* Arguments:
|
2018-08-27 21:06:57 +08:00
|
|
|
* ptr - The pointer to the member.
|
2018-08-27 20:52:02 +08:00
|
|
|
* type - The type of the container struct this is embedded in.
|
|
|
|
* member - The name of the member within the struct.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define container_of(ptr, type, member) \
|
|
|
|
((type *)((uintptr_t)(ptr) - offsetof(type, member)))
|
|
|
|
|
sched: move etc romfs mount from nsh to sched/init
Usually the startup script is placed under /etc. The contents of the etc directory
are compiled and linked with Nuttx binary in the form of romfs. After startup,
it will be mounted by Nsh.
etc is generated by the different boards, that use genromfs and xxd tools to generate
and compile it into the Nuttx, for example: boards/arm/at32/at32f437-mini/tool/mkromfs.sh
The more common method is etc image generated from the content in the corresponding
board/arch/board/board/src/etc directory, and added by Makefile for example:
boards/sim/sim/sim/src/etc.
But in kernel/protected mode, Nuttx kernel and apps are run in different privileged/
non-privileged mode or the isolated binarys, so as that nsh should use syscall to
access Nuttx kernel by exported API. In this scenario, nsh can not mount the etc image
content, because that is generated in board and as a part of Nuttx kernel.
changes:
- move etc romfs mount from nsh to Nuttx, but keep the script to parse and execute.
- move and rename the related CONFIG, move customized nsh_romfsimg.h to etc_romfs.c
in boards, and no need declaration for romfs_img/romfs_img_len.
This commit changes and updates all configurations in Nuttx arch/board as much as possible,
but if any missing, please refer to the following simple guide:
- rename CONFIG_NSH_ROMFSETC to CONFIG_ETC_ROMFS, and delete CONFIG_NSH_ARCHROMFS in defconfig
- rename the etc romfs mount configs, for example CONFIG_NSH_FATDEVNO to CONFIG_ETC_FATDEVNO
- move customized nsh_romfsimg.h to etc_romfs.c in board/arch/board/board/src and no need
declaration for romfs_img/romfs_img_len.
- delete default nsh_romfsimg.h, if ROMFSETC is enabled, should generate and compile etc_romfs.c
in board/arch/board/board/src.
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-11-26 11:51:46 +08:00
|
|
|
/* Stringify the arguments */
|
|
|
|
|
|
|
|
#define STRINGIFY_(x) #x
|
|
|
|
#define STRINGIFY(x) STRINGIFY_(x)
|
|
|
|
|
2018-08-27 20:52:02 +08:00
|
|
|
#endif /* __INCLUDE_NUTTX_NUTTX_H */
|