Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add veneer to Hongmeng transplant raspberry pie

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to add veneer to Hongmeng's raspberry pie. The editor thinks it is very practical, so I share it with you. I hope you can learn something after reading this article. Let's take a look at it with the editor.

1. Add a new veneer

1.1.Modification of menuconfig and Kconfig

In order to add the raspberry pie development board to Hongmeng's source code, we must first analyze Hongmeng's compilation and construction system. Menuconfig can generate a .config (kernel\ liteos_a.config) file through the Kconfig configuration file, in which the compiled configuration items for the kernel are included.

1.1.1. Add veneer

Go to the source code / kernel/liteos_a/ directory to execute

Make menuconfig

This takes you to the interface shown below, which is generated based on the file\ kernel\ liteos_a\ Kconfig, which can also contain Kconfig in other directories.

Contains the Kconfig in other directories, such as: source ".. / kernel/liteos_a/platform/Kconfig" # this file is the Kconfig source ".. / kernel/liteos_a/arch/Kconfig" that adds the new development board.

1.1.2. Modify kernel\ liteos_a\ platform\ Kconfig

Open ".. /.. / kernel/liteos_a/platform/Kconfig", imitate other veneers, and add raspberry pie configuration items.

Add under config PLATFORM:

Default "Raspberry_Pi_2" if PLATFORM_RASPBERRYPI2

Add under choice:

Config PLATFORM_RASPBERRYPI2 bool "Raspberry_Pi_2" select ARCH_CORTEX_A7

After adding these two items, rerun make menuconfig and select platform will have a new veneer option.

1.1.3. Modify kernel\ liteos_a\ Kconfig

Set the default compiler for the veneer, around lines 45 and 49.

Config COMPILER_HIMIX_32 bool "arm-linux-ohoseabi" depends on PLATFORM_HI3518EV300 | | PLATFORM_HI3516DV300 | | PLATFORM_RASPBERRYPI2 config COMPILER_CLANG_LLVM bool "clang-llvm" depends on PLATFORM_HI3518EV300 | | PLATFORM_HI3516DV300 | | PLATFORM_RASPBERRYPI2

The compiler selection will not appear until these two Compiler items are added, as shown below:

After selecting this new veneer to save and exit, look at\ kernel\ liteos_a.config and you will find that there are two more items below.

# # Platform # LOSCFG_PLATFORM= "Raspberry_Pi_2" # LOSCFG_PLATFORM_HI3516DV300 is not set # LOSCFG_PLATFORM_HI3518EV300 is not set LOSCFG_PLATFORM_RASPBERRYPI2=y

1.2.Modification of make and Makefile files

Makefile platform/Makefile platform/bsp.mk

1.2.1. Modify kernel\ liteos_a\ Makefile

Set the root file system type and size, about 62 lines.

Ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2), y) FSTYPE = jffs2 ROOTFS_SIZE = 0xA00000 endif

Add veneer folder under make lib, around 107lines. At the same time, add the corresponding folder under the source directory / vendor/. Some of Hongmeng's code is not open source. Here, thanks to the patch file provided by teacher Wei Dongshan.

# make lib # $(_ _ LIBS): $(OUT) $(CXX_INCLUDE) ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2)) Y) BOARD_INCLUDE_DIR: = $(LITEOSTOPDIR) /.. /.. / vendor/broadcom/BCM2836/board else BOARD_INCLUDE_DIR: = $(LITEOSTOPDIR) /.. / vendor/hisi/hi35xx/$ (LITEOS_PLATFORM) / config/board endif $(OUT): $(LITEOS_MENUCONFIG_H) $(HIDE) mkdir-p $(OUT) / lib $(HIDE) $(CC)-I $(LITEOS_PLATFORM_BASE) / include-I $(BOARD_INCLUDE_) DIR)\-E $(LITEOS_PLATFORM_BASE) / board.ld.S\-o $(LITEOS_PLATFORM_BASE) / board.ld-P

1.2.2. Add veneer folder

Create a new veneer folder, copy the vendor folder in Wei Dongshan's teacher's patch, and create a new broadcom under the vendor directory.

The directory structure of veneer files can be modified in the following format:

Kernel / architecture / chip company / chip / board company / hardware version

Cortex-A7/Armv7-A/broadcom/BCM2836/Raspberry_Pi/.. Vendor\ broadcom\ BCM2836\ board\ include\ asm\ platform.h

1.2.3, then modify vendor\ broadcom\ BCM2836\ BCM2836.mk

Set the base directory address

BCM2836_BASE_DIR: = $(LITEOSTOPDIR) /.. /.. / vendor/broadcom/BCM2836

1.2.4, kernel\ liteos_a\ platform\ Makefile

Imitate other veneers to add, about 43 lines

$(LOSCFG_PLATFORM_RASPBERRYPI2)\ ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300) $(LOSCFG_PLATFORM_HI3516DV300) $(LOSCFG_PLATFORM_RASPBERRYPI2)), y)

1.2.5, kernel\ liteos_a\ platform\ bsp.mk

Set the device type of the veneer, such as interrupt, timer, serial port, USB, etc., about 58 lines

# # LOSCFG_PLATFORM_RASPBERRYPI2 Options## else ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2), y) HWI_TYPE: = arm/interrupt/gic TIMER_TYPE: = arm/timer/arm_generic HRTIMER_TYPE: = BCM2836/hrtimer # UART_TYPE: = amba_pl011

Set the directory to be included in the header file, about 90 lines

Ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300) $(LOSCFG_PLATFORM_HI3516DV300)), y) PLATFORM_INCLUDE + =-I $(LITEOSTOPDIR) /.. /.. / vendor/hisi/hi35xx/$ (LITEOS_PLATFORM) / config/board/include/hisoc else ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2), y) PLATFORM_INCLUDE + =-I $(LITEOSTOPDIR) /.. /.. / vendor/broadcom/BCM2836/board/include endif

1.2.6, drivers\ hdf\ lite\ hdf_lite.mk

Set up the top-level directory of HDF, which is about 39 lines. I don't understand why you don't use a default path directly.

Replace include $(LITEOSTOPDIR) /.. /.. / vendor/huawei/hdf/hdf_vendor.mk with: ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300) $(LOSCFG_PLATFORM_HI3516DV300)), y) include $(LITEOSTOPDIR) /.. / vendor/huawei/hdf/hdf_vendor.mk endif ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2), y) include $(LITEOSTOPDIR) /.. / vendor/broadcom/hdf/hdf_vendor.mk endif

1.2.7, vendor\ huawei\ hdf\ hdf_vendor.mk (TODO)

Set the HDF-related file path of the veneer, about 18 lines

Else ifeq ($(LOSCFG_PLATFORM_RASPBERRYPI2), y) LIB_SUBDIRS + = $(LITEOS_SOURCE_ROOT) / vendor/broadcom/BCM2836/config VENDOR_HDF_DRIVERS_PLATFORM_ROOT: = $(LITEOSTOPDIR) /.. /.. / vendor/broadcom/BCM2836/platform # this folder is not yet available

1.3. Compilation:

When compiling the test, you can modify the value of kernel\ liteos_a\ tools\ build\ mk\ los_config.mk HIDE to show the execution command of make.

HIDE: = # Delete @ indicates the execution command that displays make

1.3.1. Modify the following four header files

Kernel/liteos_a/shell/full/src/base/show.c

Kernel/liteos_a/shell/full/src/base/shcmd.c

Kernel/liteos_a/shell/full/src/base/shmsg.c

Kernel/liteos_a/shell/full/src/cmds/dmesg.c

# elif defined LOSCFG_PLATFORM_RASPBERRYPI2 # include "uart.h"

1.3.2, tools\ build\ mk\ los_config.mk

Ifeq ($(LITEOS_PLATFORM), BCM2836) include $(LITEOSTOPDIR) /.. /.. / vendor/broadcom/BCM2836/BCM2836.mk endif

1.3.3. Kernel\ liteos_a\ kernel\ common\ los_config.h

About 43 lines, comment on this line

/ / # include "hisoc/clock.h" # include "clock.h" above is how to add a veneer to Hongmeng's transplant raspberry pie. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report