mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
boards/arm/stm32{f1,f4}: drop duplicated reset.c/romfs, use common board logic
The board-common stm32_reset.c and stm32_romfs_initialize.c are already provided by boards/arm/common/stm32. Remove the redundant local copies from boards Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
parent
de4f3bf92c
commit
18a288097b
36 changed files with 16 additions and 1196 deletions
|
|
@ -22,10 +22,6 @@
|
|||
|
||||
set(SRCS stm32_boot.c stm32_bringup.c stm32_spi.c)
|
||||
|
||||
if(CONFIG_BOARDCTL_RESET)
|
||||
list(APPEND SRCS stm32_reset.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_BUTTONS)
|
||||
list(APPEND SRCS stm32_buttons.c)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@ include $(TOPDIR)/Make.defs
|
|||
|
||||
CSRCS = stm32_boot.c stm32_bringup.c stm32_spi.c
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||
CSRCS += stm32_reset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += stm32_buttons.c
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f1/stm32f103-minimum/src/stm32_reset.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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_reset
|
||||
*
|
||||
* Description:
|
||||
* Reset board. Support for this function is required by board-level
|
||||
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||
*
|
||||
* Input Parameters:
|
||||
* status - Status information provided with the reset event. This
|
||||
* meaning of this status information is board-specific. If not
|
||||
* used by a board, the value zero may be provided in calls to
|
||||
* board_reset().
|
||||
*
|
||||
* Returned Value:
|
||||
* If this function returns, then it was not possible to power-off the
|
||||
* board due to some constraints. The return value int this case is a
|
||||
* board-specific reason for the failure to shutdown.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_reset(int status)
|
||||
{
|
||||
#ifdef CONFIG_STM32_DFU
|
||||
/* TODO handle reboot to bootloader */
|
||||
|
||||
#endif
|
||||
|
||||
up_systemreset();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -60,14 +60,6 @@ if(CONFIG_STM32_BBSRAM)
|
|||
list(APPEND SRCS stm32_bbsram.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BOARDCTL_RESET)
|
||||
list(APPEND SRCS stm32_reset.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_STM32_ROMFS)
|
||||
list(APPEND SRCS stm32_romfs_initialize.c)
|
||||
endif()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script")
|
||||
|
|
|
|||
|
|
@ -62,14 +62,6 @@ ifeq ($(CONFIG_STM32_BBSRAM),y)
|
|||
CSRCS += stm32_bbsram.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||
CSRCS += stm32_reset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_ROMFS),y)
|
||||
CSRCS += stm32_romfs_initialize.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/nucleo-f429zi/src/stm32_reset.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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_reset
|
||||
*
|
||||
* Description:
|
||||
* Reset board. Support for this function is required by board-level
|
||||
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||
*
|
||||
* Input Parameters:
|
||||
* status - Status information provided with the reset event. This
|
||||
* meaning of this status information is board-specific. If not
|
||||
* used by a board, the value zero may be provided in calls to
|
||||
* board_reset().
|
||||
*
|
||||
* Returned Value:
|
||||
* If this function returns, then it was not possible to power-off the
|
||||
* board due to some constraints. The return value int this case is a
|
||||
* board-specific reason for the failure to shutdown.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_reset(int status)
|
||||
{
|
||||
up_systemreset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOARDCTL_RESET */
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/nucleo-f429zi/src/stm32_romfs_initialize.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file provides contents of an optional ROMFS volume, mounted at boot */
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/ramdisk.h>
|
||||
#include "stm32_romfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS
|
||||
# error "CONFIG_STM32_ROMFS must be defined"
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_IMAGEFILE
|
||||
# error "CONFIG_STM32_ROMFS_IMAGEFILE must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_DEV_MINOR
|
||||
# error "CONFIG_STM32_ROMFS_DEV_MINOR must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_MOUNTPOINT
|
||||
# error "CONFIG_STM32_ROMFS_MOUNTPOINT must be defined"
|
||||
#endif
|
||||
|
||||
#define NSECTORS(size) (((size) + ROMFS_SECTOR_SIZE - 1)/ROMFS_SECTOR_SIZE)
|
||||
|
||||
#define STR2(m) #m
|
||||
#define STR(m) STR2(m)
|
||||
|
||||
#define MKMOUNT_DEVNAME(m) "/dev/ram" STR(m)
|
||||
#define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_STM32_ROMFS_DEV_MINOR)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
__asm__ (
|
||||
" .section .rodata, \"a\" \n"
|
||||
" .balign 16 \n"
|
||||
" .globl romfs_data_begin \n"
|
||||
"romfs_data_begin: \n"
|
||||
" .incbin " STR(CONFIG_STM32_ROMFS_IMAGEFILE)"\n"
|
||||
" .balign " STR(ROMFS_SECTOR_SIZE) "\n"
|
||||
" .globl romfs_data_end \n"
|
||||
"romfs_data_end: \n"
|
||||
);
|
||||
|
||||
extern const uint8_t romfs_data_begin[];
|
||||
extern const uint8_t romfs_data_end[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers the aboveincluded binary file as block device.
|
||||
* Then mounts the block device as ROMFS filesystems.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_end) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void)
|
||||
{
|
||||
size_t romfs_data_len;
|
||||
int ret;
|
||||
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
romfs_data_len = romfs_data_end - romfs_data_begin;
|
||||
|
||||
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
|
||||
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: romdisk_register failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Mount the file system */
|
||||
|
||||
finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
|
||||
CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME);
|
||||
|
||||
ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT,
|
||||
"romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n",
|
||||
MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
|
@ -30,26 +30,4 @@ config NUCLEO_F446RE_AJOY_MINBUTTONS
|
|||
minimal set: SELECT (joystick down), FIRE (BUTTON B), and JUMP
|
||||
(BUTTON A).
|
||||
|
||||
config STM32_ROMFS
|
||||
bool "Automount baked-in ROMFS image"
|
||||
default n
|
||||
depends on FS_ROMFS
|
||||
---help---
|
||||
Select STM32_ROMFS_IMAGEFILE, STM32_ROMFS_DEV_MINOR, STM32_ROMFS_MOUNTPOINT
|
||||
|
||||
config STM32_ROMFS_DEV_MINOR
|
||||
int "Minor for the block device backing the data"
|
||||
depends on STM32_ROMFS
|
||||
default 64
|
||||
|
||||
config STM32_ROMFS_MOUNTPOINT
|
||||
string "Mountpoint of the custom romfs image"
|
||||
depends on STM32_ROMFS
|
||||
default "/rom"
|
||||
|
||||
config STM32_ROMFS_IMAGEFILE
|
||||
string "ROMFS image file to include into build"
|
||||
depends on STM32_ROMFS
|
||||
default "../../../rom.img"
|
||||
|
||||
endif # ARCH_BOARD_NUCLEO_F446RE
|
||||
|
|
|
|||
|
|
@ -70,10 +70,6 @@ if(CONFIG_BOARD_STM32_IHM08M1)
|
|||
list(APPEND SRCS stm32_foc_ihm08m1.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_STM32_ROMFS)
|
||||
list(APPEND SRCS stm32_romfs_initialize.c)
|
||||
endif()
|
||||
|
||||
target_sources(board PRIVATE ${SRCS})
|
||||
|
||||
set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/f446re.ld")
|
||||
|
|
|
|||
|
|
@ -72,10 +72,6 @@ ifeq ($(CONFIG_BOARD_STM32_IHM08M1),y)
|
|||
CSRCS += stm32_foc_ihm08m1.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_ROMFS),y)
|
||||
CSRCS += stm32_romfs_initialize.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path board
|
||||
VPATH += :board
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@
|
|||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "stm32_romfs.h"
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
# include "stm32_romfs.h"
|
||||
#endif
|
||||
#include "nucleo-f446re.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/nucleo-f446re/src/stm32_romfs.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_NUCLEO_F446RE_SRC_STM32_ROMFS_H
|
||||
#define __BOARDS_ARM_STM32_NUCLEO_F446RE_SRC_STM32_ROMFS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ROMFS_SECTOR_SIZE 64
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers built-in ROMFS image as block device and mounts it.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_begin) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void);
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32_NUCLEO_F446RE_SRC_STM32_ROMFS_H */
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/nucleo-f446re/src/stm32_romfs_initialize.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file provides contents of an optional ROMFS volume, mounted at boot */
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/ramdisk.h>
|
||||
#include "stm32_romfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS
|
||||
# error "CONFIG_STM32_ROMFS must be defined"
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_IMAGEFILE
|
||||
# error "CONFIG_STM32_ROMFS_IMAGEFILE must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_DEV_MINOR
|
||||
# error "CONFIG_STM32_ROMFS_DEV_MINOR must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_MOUNTPOINT
|
||||
# error "CONFIG_STM32_ROMFS_MOUNTPOINT must be defined"
|
||||
#endif
|
||||
|
||||
#define NSECTORS(size) (((size) + ROMFS_SECTOR_SIZE - 1)/ROMFS_SECTOR_SIZE)
|
||||
|
||||
#define STR2(m) #m
|
||||
#define STR(m) STR2(m)
|
||||
|
||||
#define MKMOUNT_DEVNAME(m) "/dev/ram" STR(m)
|
||||
#define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_STM32_ROMFS_DEV_MINOR)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
__asm__ (
|
||||
" .section .rodata, \"a\" \n"
|
||||
" .balign 16 \n"
|
||||
" .globl romfs_data_begin \n"
|
||||
"romfs_data_begin: \n"
|
||||
" .incbin " STR(CONFIG_STM32_ROMFS_IMAGEFILE)"\n"
|
||||
" .balign " STR(ROMFS_SECTOR_SIZE) "\n"
|
||||
" .globl romfs_data_end \n"
|
||||
"romfs_data_end: \n"
|
||||
);
|
||||
|
||||
extern const uint8_t romfs_data_begin[];
|
||||
extern const uint8_t romfs_data_end[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers the aboveincluded binary file as block device.
|
||||
* Then mounts the block device as ROMFS filesystems.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [&romfs_data_begin .. &romfs_data_begin) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void)
|
||||
{
|
||||
uintptr_t romfs_data_len;
|
||||
int ret;
|
||||
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
romfs_data_len = (uintptr_t)romfs_data_end - (uintptr_t)romfs_data_begin;
|
||||
|
||||
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
|
||||
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: romdisk_register failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Mount the file system */
|
||||
|
||||
finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
|
||||
CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME);
|
||||
|
||||
ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT,
|
||||
"romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n",
|
||||
MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
|
@ -5,26 +5,4 @@
|
|||
|
||||
if ARCH_BOARD_OMNIBUSF4
|
||||
|
||||
config STM32_ROMFS
|
||||
bool "Automount baked-in ROMFS image"
|
||||
default n
|
||||
depends on FS_ROMFS
|
||||
---help---
|
||||
Select STM32_ROMFS_IMAGEFILE, STM32_ROMFS_DEV_MINOR, STM32_ROMFS_MOUNTPOINT
|
||||
|
||||
config STM32_ROMFS_DEV_MINOR
|
||||
int "Minor for the block device backing the data"
|
||||
depends on STM32_ROMFS
|
||||
default 64
|
||||
|
||||
config STM32_ROMFS_MOUNTPOINT
|
||||
string "Mountpoint of the custom romfs image"
|
||||
depends on STM32_ROMFS
|
||||
default "/rom"
|
||||
|
||||
config STM32_ROMFS_IMAGEFILE
|
||||
string "ROMFS image file to include into build"
|
||||
depends on STM32_ROMFS
|
||||
default "../../../rom.img"
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -62,10 +62,6 @@ if(CONFIG_TIMER)
|
|||
list(APPEND SRCS stm32_timer.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_STM32_ROMFS)
|
||||
list(APPEND SRCS stm32_romfs_initialize.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BOARDCTL_UNIQUEID)
|
||||
list(APPEND SRCS stm32_uid.c)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -63,10 +63,6 @@ ifeq ($(CONFIG_TIMER),y)
|
|||
CSRCS += stm32_timer.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_ROMFS),y)
|
||||
CSRCS += stm32_romfs_initialize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
|
||||
CSRCS += stm32_uid.c
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@
|
|||
#endif
|
||||
|
||||
#include "stm32.h"
|
||||
#include "stm32_romfs.h"
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
# include "stm32_romfs.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
# include "stm32_usbhost.h"
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/omnibusf4/src/stm32_romfs.h
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
* SPDX-FileCopyrightText: 2017 Tomasz Wozniak. All rights reserved.
|
||||
* SPDX-FileContributor: Tomasz Wozniak <t.wozniak@samsung.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_OMNIBUSF4_SRC_STM32_ROMFS_H
|
||||
#define __BOARDS_ARM_STM32_OMNIBUSF4_SRC_STM32_ROMFS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ROMFS_SECTOR_SIZE 64
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers built-in ROMFS image as block device and mounts it.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_end) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void);
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32_OMNIBUSF4_SRC_STM32_ROMFS_H */
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/omnibusf4/src/stm32_romfs_initialize.c
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
* SPDX-FileCopyrightText: 2017 Tomasz Wozniak. All rights reserved.
|
||||
* SPDX-FileContributor: Tomasz Wozniak <t.wozniak@samsung.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/ramdisk.h>
|
||||
#include "stm32_romfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS
|
||||
# error "CONFIG_STM32_ROMFS must be defined"
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_IMAGEFILE
|
||||
# error "CONFIG_STM32_ROMFS_IMAGEFILE must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_DEV_MINOR
|
||||
# error "CONFIG_STM32_ROMFS_DEV_MINOR must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_MOUNTPOINT
|
||||
# error "CONFIG_STM32_ROMFS_MOUNTPOINT must be defined"
|
||||
#endif
|
||||
|
||||
#define NSECTORS(size) (((size) + ROMFS_SECTOR_SIZE - 1)/ROMFS_SECTOR_SIZE)
|
||||
|
||||
#define STR2(m) #m
|
||||
#define STR(m) STR2(m)
|
||||
|
||||
#define MKMOUNT_DEVNAME(m) "/dev/ram" STR(m)
|
||||
#define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_STM32_ROMFS_DEV_MINOR)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
__asm__ (
|
||||
".section .rodata, \"a\"\n"
|
||||
".balign 16\n"
|
||||
".globl romfs_data_begin\n"
|
||||
"romfs_data_begin:\n"
|
||||
".incbin " STR(CONFIG_STM32_ROMFS_IMAGEFILE) "\n"\
|
||||
\
|
||||
".balign " STR(ROMFS_SECTOR_SIZE) "\n"
|
||||
".globl romfs_data_end\n"
|
||||
"romfs_data_end:\n");
|
||||
|
||||
extern const uint8_t romfs_data_begin[];
|
||||
extern const uint8_t romfs_data_end[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers the aboveincluded binary file as block device.
|
||||
* Then mounts the block device as ROMFS filesystems.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_end) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void)
|
||||
{
|
||||
size_t romfs_data_len
|
||||
int ret;
|
||||
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
romfs_data_len = romfs_data_end - romfs_data_begin;
|
||||
|
||||
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
|
||||
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: romdisk_register failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Mount the file system */
|
||||
|
||||
finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
|
||||
CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME);
|
||||
|
||||
ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT,
|
||||
"romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n",
|
||||
MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
# CONFIG_SYSTEM_TELNETD is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f401rc-rs485"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F401RC_RS485=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@ if(CONFIG_USERLED)
|
|||
list(APPEND SRCS stm32_userleds.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BOARDCTL_RESET)
|
||||
list(APPEND SRCS stm32_reset.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_BUTTONS)
|
||||
list(APPEND SRCS stm32_buttons.c)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ ifeq ($(CONFIG_USERLED),y)
|
|||
CSRCS += stm32_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||
CSRCS += stm32_reset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += stm32_buttons.c
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/stm32f401rc-rs485/src/stm32_reset.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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_reset
|
||||
*
|
||||
* Description:
|
||||
* Reset board. Support for this function is required by board-level
|
||||
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||
*
|
||||
* Input Parameters:
|
||||
* status - Status information provided with the reset event. This
|
||||
* meaning of this status information is board-specific. If not
|
||||
* used by a board, the value zero may be provided in calls to
|
||||
* board_reset().
|
||||
*
|
||||
* Returned Value:
|
||||
* If this function returns, then it was not possible to power-off the
|
||||
* board due to some constraints. The return value int this case is a
|
||||
* board-specific reason for the failure to shutdown.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_reset(int status)
|
||||
{
|
||||
up_systemreset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOARDCTL_RESET */
|
||||
|
|
@ -12,28 +12,6 @@ config STM32F4DISBB
|
|||
Select if you are using the STM32F4DIS-BB base board with the
|
||||
STM32F4Discovery.
|
||||
|
||||
config STM32_ROMFS
|
||||
bool "Automount baked-in ROMFS image"
|
||||
default n
|
||||
depends on FS_ROMFS
|
||||
---help---
|
||||
Select STM32_ROMFS_IMAGEFILE, STM32_ROMFS_DEV_MINOR, STM32_ROMFS_MOUNTPOINT
|
||||
|
||||
config STM32_ROMFS_DEV_MINOR
|
||||
int "Minor for the block device backing the data"
|
||||
depends on STM32_ROMFS
|
||||
default 64
|
||||
|
||||
config STM32_ROMFS_MOUNTPOINT
|
||||
string "Mountpoint of the custom romfs image"
|
||||
depends on STM32_ROMFS
|
||||
default "/rom"
|
||||
|
||||
config STM32_ROMFS_IMAGEFILE
|
||||
string "ROMFS image file to include into build"
|
||||
depends on STM32_ROMFS
|
||||
default "../../../../../rom.img"
|
||||
|
||||
config STM32F4DISCO_USBHOST_STACKSIZE
|
||||
int "USB host waiter stack size"
|
||||
default 1024
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ CONFIG_ADBD_SHELL_SERVICE=y
|
|||
CONFIG_ADBD_USB_SERVER=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
# CONFIG_STM32_CCMEXCLUDE is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
CONFIG_ALLOW_BSD_COMPONENTS=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
# CONFIG_SPI_CALLBACK is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="stm32f4discovery"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y
|
||||
CONFIG_ARCH_BUTTONS=y
|
||||
CONFIG_ARCH_CHIP="stm32f4"
|
||||
|
|
|
|||
|
|
@ -92,10 +92,6 @@ if(CONFIG_PWM)
|
|||
list(APPEND SRCS stm32_pwm.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BOARDCTL_RESET)
|
||||
list(APPEND SRCS stm32_reset.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_CUSTOM_PMINIT)
|
||||
list(APPEND SRCS stm32_pm.c)
|
||||
endif()
|
||||
|
|
@ -138,10 +134,6 @@ if(CONFIG_STM32_HCIUART)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_STM32_ROMFS)
|
||||
list(APPEND SRCS stm32_romfs_initialize.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BOARDCTL_UNIQUEID)
|
||||
list(APPEND SRCS stm32_uid.c)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -98,10 +98,6 @@ ifeq ($(CONFIG_CAPTURE),y)
|
|||
CSRCS += stm32_capture.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_RESET),y)
|
||||
CSRCS += stm32_reset.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_CUSTOM_PMINIT),y)
|
||||
CSRCS += stm32_pm.c
|
||||
endif
|
||||
|
|
@ -148,10 +144,6 @@ CSRCS += stm32_hciuart.c
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STM32_ROMFS),y)
|
||||
CSRCS += stm32_romfs_initialize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
|
||||
CSRCS += stm32_uid.c
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@
|
|||
#endif
|
||||
|
||||
#include "stm32.h"
|
||||
#include "stm32_romfs.h"
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
# include "stm32_romfs.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_OTGFS
|
||||
# include "stm32_usbhost.h"
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/stm32f4discovery/src/stm32_reset.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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#ifdef CONFIG_BOARDCTL_RESET
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_reset
|
||||
*
|
||||
* Description:
|
||||
* Reset board. Support for this function is required by board-level
|
||||
* logic if CONFIG_BOARDCTL_RESET is selected.
|
||||
*
|
||||
* Input Parameters:
|
||||
* status - Status information provided with the reset event. This
|
||||
* meaning of this status information is board-specific. If not
|
||||
* used by a board, the value zero may be provided in calls to
|
||||
* board_reset().
|
||||
*
|
||||
* Returned Value:
|
||||
* If this function returns, then it was not possible to power-off the
|
||||
* board due to some constraints. The return value int this case is a
|
||||
* board-specific reason for the failure to shutdown.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_reset(int status)
|
||||
{
|
||||
up_systemreset();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOARDCTL_RESET */
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/stm32f4discovery/src/stm32_romfs.h
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
* SPDX-FileCopyrightText: 2017 Tomasz Wozniak. All rights reserved.
|
||||
* SPDX-FileContributor: Tomasz Wozniak <t.wozniak@samsung.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32_STM32F4DISCOVERY_SRC_STM32_ROMFS_H
|
||||
#define __BOARDS_ARM_STM32_STM32F4DISCOVERY_SRC_STM32_ROMFS_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifdef CONFIG_STM32_ROMFS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ROMFS_SECTOR_SIZE 64
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers built-in ROMFS image as block device and mounts it.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_end) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void);
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32_STM32F4DISCOVERY_SRC_STM32_ROMFS_H */
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/stm32f4/stm32f4discovery/src/stm32_romfs_initialize.c
|
||||
* This file provides contents of an optional ROMFS volume, mounted at boot.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
* SPDX-FileCopyrightText: 2017 Tomasz Wozniak. All rights reserved.
|
||||
* SPDX-FileContributor: Tomasz Wozniak <t.wozniak@samsung.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <nuttx/debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/drivers/ramdisk.h>
|
||||
#include "stm32_romfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS
|
||||
# error "CONFIG_STM32_ROMFS must be defined"
|
||||
#else
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_IMAGEFILE
|
||||
# error "CONFIG_STM32_ROMFS_IMAGEFILE must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_DEV_MINOR
|
||||
# error "CONFIG_STM32_ROMFS_DEV_MINOR must be defined"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_ROMFS_MOUNTPOINT
|
||||
# error "CONFIG_STM32_ROMFS_MOUNTPOINT must be defined"
|
||||
#endif
|
||||
|
||||
#define NSECTORS(size) (((size) + ROMFS_SECTOR_SIZE - 1)/ROMFS_SECTOR_SIZE)
|
||||
|
||||
#define STR2(m) #m
|
||||
#define STR(m) STR2(m)
|
||||
|
||||
#define MKMOUNT_DEVNAME(m) "/dev/ram" STR(m)
|
||||
#define MOUNT_DEVNAME MKMOUNT_DEVNAME(CONFIG_STM32_ROMFS_DEV_MINOR)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
__asm__ (
|
||||
".section .rodata, \"a\"\n"
|
||||
".balign 16\n"
|
||||
".globl romfs_data_begin\n"
|
||||
"romfs_data_begin:\n"
|
||||
".incbin " STR(CONFIG_STM32_ROMFS_IMAGEFILE) "\n"\
|
||||
\
|
||||
".balign " STR(ROMFS_SECTOR_SIZE) "\n"
|
||||
".globl romfs_data_end\n"
|
||||
"romfs_data_end:\n");
|
||||
|
||||
extern const uint8_t romfs_data_begin[];
|
||||
extern const uint8_t romfs_data_end[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_romfs_initialize
|
||||
*
|
||||
* Description:
|
||||
* Registers the aboveincluded binary file as block device.
|
||||
* Then mounts the block device as ROMFS filesystems.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success, a negated errno value on error.
|
||||
*
|
||||
* Assumptions/Limitations:
|
||||
* Memory addresses [romfs_data_begin .. romfs_data_end) should contain
|
||||
* ROMFS volume data, as included in the assembly snippet above (l. 84).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32_romfs_initialize(void)
|
||||
{
|
||||
size_t romfs_data_len;
|
||||
int ret;
|
||||
|
||||
/* Create a ROM disk for the /etc filesystem */
|
||||
|
||||
romfs_data_len = romfs_data_end - romfs_data_begin;
|
||||
|
||||
ret = romdisk_register(CONFIG_STM32_ROMFS_DEV_MINOR, romfs_data_begin,
|
||||
NSECTORS(romfs_data_len), ROMFS_SECTOR_SIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: romdisk_register failed: %d\n", -ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Mount the file system */
|
||||
|
||||
finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
|
||||
CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME);
|
||||
|
||||
ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT,
|
||||
"romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n",
|
||||
MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32_ROMFS */
|
||||
Loading…
Add table
Add a link
Reference in a new issue