Skip to content

Commit

Permalink
Added the comments of bringup() under gd32fxxx.h, modified the compil…
Browse files Browse the repository at this point in the history
…ation options of the makefile, and modified the execution logic of the board_late_initialize(), which is consistent with the stm32 series.
  • Loading branch information
GC2020 authored and xiaoxiang781216 committed Jan 31, 2024
1 parent 95de7b8 commit 6308a53
Show file tree
Hide file tree
Showing 12 changed files with 87 additions and 75 deletions.
13 changes: 7 additions & 6 deletions boards/arm/gd32f4/gd32f450zk-eval/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ include $(TOPDIR)/Make.defs

CSRCS = gd32f4xx_boot.c

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c
endif
# ifeq ($(CONFIG_BOARDCTL),y)
# CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
# else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
# CSRCS += gd32f4xx_bringup.c
# CSRCS += gd32f4xx_appinit.c
# endif

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
CSRCS += gd32f4xx_bringup.c
endif

ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += gd32f4xx_autoleds.c
else
Expand Down
20 changes: 20 additions & 0 deletions boards/arm/gd32f4/gd32f450zk-eval/src/gd32f450z_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@

#ifndef __ASSEMBLY__

/****************************************************************************
* Name: gd32_bringup
*
* Description:
* Perform architecture specific initialization
*
* CONFIG_BOARDCTL=y:
* If CONFIG_NSH_ARCHINIT=y:
* Called from the NSH library (or other application)
* Otherwise, assumed to be called from some other application.
*
* Otherwise CONFIG_BOARD_LATE_INITIALIZE=y:
* Called from board_late_initialize().
*
* Otherwise, bad news: Never called
*
****************************************************************************/

int gd32_bringup(void);

/****************************************************************************
* Name: gd32_spidev_initialize
*
Expand Down
9 changes: 2 additions & 7 deletions boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ void gd32_boardinitialize(void)
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL)
/* Perform NSH initialization here instead of from the NSH. This
* alternative NSH initialization is necessary when NSH is ran in
* user-space but the initialization function must run in kernel space.
*/
/* Perform board-specific initialization */

board_app_initialize(0);
#endif
gd32_bringup();
}
#endif
12 changes: 0 additions & 12 deletions boards/arm/gd32f4/gd32f450zk-eval/src/gd32f4xx_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nxffs.h>
#include <nuttx/fs/rpmsgfs.h>
#include <nuttx/spi/spi_transfer.h>
#include <nuttx/rc/dummy.h>

Expand Down Expand Up @@ -194,17 +193,6 @@ int gd32_bringup(void)
}
#endif

#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */

ret = nx_mount(NULL, GD32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
GD32_PROCFS_MOUNTPOINT, ret);
}
#endif

#ifdef CONFIG_GD32F4_ROMFS
/* Mount the romfs partition */

Expand Down
13 changes: 7 additions & 6 deletions boards/arm/gd32f4/gd32f470ik-eval/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ include $(TOPDIR)/Make.defs

CSRCS = gd32f4xx_boot.c

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c
endif
# ifeq ($(CONFIG_BOARDCTL),y)
# CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
# else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
# CSRCS += gd32f4xx_bringup.c
# CSRCS += gd32f4xx_appinit.c
# endif

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
CSRCS += gd32f4xx_bringup.c
endif

ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += gd32f4xx_autoleds.c
else
Expand Down
20 changes: 20 additions & 0 deletions boards/arm/gd32f4/gd32f470ik-eval/src/gd32f470i_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@

#ifndef __ASSEMBLY__

/****************************************************************************
* Name: gd32_bringup
*
* Description:
* Perform architecture specific initialization
*
* CONFIG_BOARDCTL=y:
* If CONFIG_NSH_ARCHINITIALIZE=y:
* Called from the NSH library (or other application)
* Otherwise, assumed to be called from some other application.
*
* Otherwise CONFIG_BOARD_LATE_INITIALIZE=y:
* Called from board_late_initialize().
*
* Otherwise, bad news: Never called
*
****************************************************************************/

int gd32_bringup(void);

/****************************************************************************
* Name: gd32_spidev_initialize
*
Expand Down
9 changes: 2 additions & 7 deletions boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ void gd32_boardinitialize(void)
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL)
/* Perform NSH initialization here instead of from the NSH. This
* alternative NSH initialization is necessary when NSH is ran in
* user-space but the initialization function must run in kernel space.
*/
/* Perform board-specific initialization */

board_app_initialize(0);
#endif
gd32_bringup();
}
#endif
12 changes: 0 additions & 12 deletions boards/arm/gd32f4/gd32f470ik-eval/src/gd32f4xx_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nxffs.h>
#include <nuttx/fs/rpmsgfs.h>
#include <nuttx/spi/spi_transfer.h>
#include <nuttx/rc/dummy.h>

Expand Down Expand Up @@ -194,17 +193,6 @@ int gd32_bringup(void)
}
#endif

#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */

ret = nx_mount(NULL, GD32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
GD32_PROCFS_MOUNTPOINT, ret);
}
#endif

#ifdef CONFIG_GD32F4_ROMFS
/* Mount the romfs partition */

Expand Down
13 changes: 7 additions & 6 deletions boards/arm/gd32f4/gd32f470zk-eval/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ include $(TOPDIR)/Make.defs

CSRCS = gd32f4xx_boot.c

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c
endif
# ifeq ($(CONFIG_BOARDCTL),y)
# CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
# else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
# CSRCS += gd32f4xx_bringup.c
# CSRCS += gd32f4xx_appinit.c
# endif

ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += gd32f4xx_appinit.c gd32f4xx_bringup.c
else ifeq ($(CONFIG_BOARD_LATE_INITIALIZE),y)
CSRCS += gd32f4xx_bringup.c
endif

ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += gd32f4xx_autoleds.c
else
Expand Down
20 changes: 20 additions & 0 deletions boards/arm/gd32f4/gd32f470zk-eval/src/gd32f470z_eval.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@

#ifndef __ASSEMBLY__

/****************************************************************************
* Name: gd32_bringup
*
* Description:
* Perform architecture specific initialization
*
* CONFIG_BOARDCTL=y:
* If CONFIG_NSH_ARCHINITIALIZE=y:
* Called from the NSH library (or other application)
* Otherwise, assumed to be called from some other application.
*
* Otherwise CONFIG_BOARD_LATE_INITIALIZE=y:
* Called from board_late_initialize().
*
* Otherwise, bad news: Never called
*
****************************************************************************/

int gd32_bringup(void);

/****************************************************************************
* Name: gd32_spidev_initialize
*
Expand Down
9 changes: 2 additions & 7 deletions boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ void gd32_boardinitialize(void)
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
#if defined(CONFIG_NSH_LIBRARY) && !defined(CONFIG_BOARDCTL)
/* Perform NSH initialization here instead of from the NSH. This
* alternative NSH initialization is necessary when NSH is ran in
* user-space but the initialization function must run in kernel space.
*/
/* Perform board-specific initialization */

board_app_initialize(0);
#endif
gd32_bringup();
}
#endif
12 changes: 0 additions & 12 deletions boards/arm/gd32f4/gd32f470zk-eval/src/gd32f4xx_bringup.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <nuttx/mtd/mtd.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nxffs.h>
#include <nuttx/fs/rpmsgfs.h>
#include <nuttx/spi/spi_transfer.h>
#include <nuttx/rc/dummy.h>

Expand Down Expand Up @@ -194,17 +193,6 @@ int gd32_bringup(void)
}
#endif

#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */

ret = nx_mount(NULL, GD32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n",
GD32_PROCFS_MOUNTPOINT, ret);
}
#endif

#ifdef CONFIG_GD32F4_ROMFS
/* Mount the romfs partition */

Expand Down

0 comments on commit 6308a53

Please sign in to comment.