-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[bsp][nxp][imx] WIP: Add FRDM-i.MX91 bsp #10570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
xusiwei
wants to merge
2
commits into
RT-Thread:master
Choose a base branch
from
xusiwei:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
mainmenu "RT-Thread Configuration" | ||
|
||
BSP_DIR := . | ||
|
||
RTT_DIR := ../../../.. | ||
|
||
PKGS_DIR := packages | ||
|
||
source "$(RTT_DIR)/Kconfig" | ||
osource "$PKGS_DIR/Kconfig" | ||
|
||
config BOARD_IMX91 | ||
bool | ||
select ARCH_ARM_CORTEX_A55 | ||
select RT_USING_GIC_V2 | ||
default y | ||
|
||
config SOC_MIMX91X1D | ||
bool | ||
select ARCH_ARMV8 | ||
select ARCH_CPU_64BIT | ||
select RT_USING_CACHE | ||
select RT_USING_COMPONENTS_INIT | ||
select RT_USING_USER_MAIN | ||
select ARCH_ARM_BOOTWITH_FLUSH_CACHE | ||
default y | ||
|
||
source "$(BSP_DIR)/drivers/Kconfig" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
scons:=python ${SCONS}\scons.py | ||
|
||
all: | ||
@$(scons) | ||
|
||
clean: | ||
@$(scons) -c | ||
|
||
copy: | ||
@$(scons) --copy -s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# i.MX91 | ||
|
||
The i.MX 91 applications processor features an Arm® Cortex®-A55 running at up to 1.4 GHz and support for modern LPDDR4 memory to enable platform longevity and reliability; dual Gigabit Ethernet for gateway or multi-network segment support; dual USB ports; and the essential I/O for products in smart factory, smart home, smart office, medical device, metering, and cost-optimized | ||
system-on-module platforms. | ||
|
||
The i.MX 91 may be used in applications such as: | ||
• EV Charging | ||
• Matter-enabled IoT Platforms | ||
• Smart Home, Office, and City | ||
• Building Automation and Monitoring | ||
• Industrial Monitoring and HMI | ||
• Portable or small form-factor Medical and Healthcare devices | ||
• Audio and Entertainment IoT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# for module compiling | ||
import os | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
objs = [] | ||
list = os.listdir(cwd) | ||
|
||
for d in list: | ||
path = os.path.join(cwd, d) | ||
if os.path.isfile(os.path.join(path, 'SConscript')): | ||
objs = objs + SConscript(os.path.join(d, 'SConscript')) | ||
|
||
Return('objs') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
import rtconfig | ||
|
||
if os.getenv('RTT_ROOT'): | ||
RTT_ROOT = os.getenv('RTT_ROOT') | ||
else: | ||
RTT_ROOT = os.path.join(os.getcwd(), '..', '..', '..', '..') | ||
|
||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] | ||
from building import * | ||
|
||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT | ||
|
||
DefaultEnvironment(tools=[]) | ||
env = Environment(tools = ['mingw'], | ||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, | ||
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS, | ||
CXX= rtconfig.CXX, CXXFLAGS = rtconfig.CFLAGS, | ||
AR = rtconfig.AR, ARFLAGS = '-rc', | ||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) | ||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH) | ||
env['ASCOM'] = env['ASPPCOM'] | ||
|
||
Export('RTT_ROOT') | ||
Export('rtconfig') | ||
|
||
# prepare building environment | ||
objs = PrepareBuilding(env, RTT_ROOT) | ||
|
||
# make a building | ||
DoBuilding(TARGET, objs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
src = Glob('*.c') + Glob('*.cpp') | ||
CPPPATH = [cwd] | ||
|
||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
config RT_USING_UART1 | ||
bool "Enable UART1" | ||
default y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
src = Glob('*.c') + Glob('iomux/*.c') | ||
|
||
CPPPATH = [cwd, cwd + '/iomux'] | ||
|
||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright (c) 2006-2025, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2025-07-12 BruceOu the first version | ||
*/ | ||
|
||
#include <rthw.h> | ||
#include <rtthread.h> | ||
|
||
#include "board.h" | ||
|
||
#include <registers/regsarmglobaltimer.h> | ||
#include <registers/regsepit.h> | ||
|
||
#include <imx_uart.h> | ||
#include <epit.h> | ||
#include <cortex_a.h> | ||
|
||
#include <mmu.h> | ||
|
||
struct mem_desc platform_mem_desc[] = { | ||
{0x00000000, 0x80000000, 0x00000000, DEVICE_MEM}, | ||
{0x80000000, 0xFFF00000, 0x80000000, NORMAL_MEM} | ||
}; | ||
|
||
const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc)/sizeof(platform_mem_desc[0]); | ||
|
||
static void rt_hw_timer_isr(int vector, void *param) | ||
{ | ||
rt_tick_increase(); | ||
epit_get_compare_event(HW_EPIT1); | ||
} | ||
|
||
int rt_hw_timer_init(void) | ||
{ | ||
uint32_t freq; | ||
|
||
// Make sure the timer is off. | ||
HW_ARMGLOBALTIMER_CONTROL.B.TIMER_ENABLE = 0; | ||
|
||
HW_ARMGLOBALTIMER_CONTROL.B.FCR0 =1; | ||
|
||
HW_ARMGLOBALTIMER_CONTROL.B.FCR1 =0; | ||
|
||
HW_ARMGLOBALTIMER_CONTROL.B.DBG_ENABLE =0; | ||
|
||
// Clear counter. | ||
HW_ARMGLOBALTIMER_COUNTER_HI_WR(0); | ||
HW_ARMGLOBALTIMER_COUNTER_LO_WR(0); | ||
|
||
// Now turn on the timer. | ||
HW_ARMGLOBALTIMER_CONTROL.B.TIMER_ENABLE = 1; | ||
|
||
freq = get_main_clock(IPG_CLK); | ||
|
||
epit_init(HW_EPIT1, CLKSRC_IPG_CLK, freq / 1000000, | ||
SET_AND_FORGET, 10000, WAIT_MODE_EN | STOP_MODE_EN); | ||
|
||
epit_counter_enable(HW_EPIT1, 10000, IRQ_MODE); | ||
|
||
rt_hw_interrupt_install(IMX_INT_EPIT1, rt_hw_timer_isr, RT_NULL, "tick"); | ||
rt_hw_interrupt_umask(IMX_INT_EPIT1); | ||
|
||
return 0; | ||
} | ||
INIT_BOARD_EXPORT(rt_hw_timer_init); | ||
|
||
/** | ||
* This function will initialize hardware board | ||
*/ | ||
void rt_hw_board_init(void) | ||
{ | ||
enable_neon_fpu(); | ||
disable_strict_align_check(); | ||
|
||
rt_components_board_init(); | ||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME); | ||
} | ||
|
||
/*@}*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2006-2025, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2025-07-12 BruceOu the first version | ||
*/ | ||
|
||
#ifndef __BOARD_H__ | ||
#define __BOARD_H__ | ||
|
||
#include <registers.h> | ||
#include <irq_numbers.h> | ||
|
||
#include "imx91.h" | ||
#include "rtconfig.h" | ||
|
||
#if defined(__CC_ARM) | ||
extern int Image$$RW_IRAM1$$ZI$$Limit; | ||
#define HEAP_BEGIN ((void*)&Image$$RW_IRAM1$$ZI$$Limit) | ||
#elif defined(__GNUC__) | ||
extern int __bss_end; | ||
#define HEAP_BEGIN ((void*)&__bss_end) | ||
#endif | ||
|
||
#define HEAP_END (void*)(0x80000000 + 32 * 1024 * 1024) | ||
|
||
void rt_hw_board_init(void); | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* COPYRIGHT (C) 2015, Real-Thread Information Technology Ltd | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2025-07-12 BruceOu The first verion | ||
*/ | ||
|
||
#ifndef __IMX91_H__ | ||
#define __IMX91_H__ | ||
|
||
#include <rthw.h> | ||
#include <rtthread.h> | ||
|
||
/* SOC-relative definitions */ | ||
//#include "realview.h" | ||
#include "gic_registers.h" | ||
#include "irq_numbers.h" | ||
|
||
/* the maximum number of gic */ | ||
# define ARM_GIC_MAX_NR 1 | ||
|
||
/* the maximum number of interrupts */ | ||
#define ARM_GIC_NR_IRQS IMX_INTERRUPT_COUNT | ||
|
||
/* the maximum entries of the interrupt table */ | ||
#define MAX_HANDLERS IMX_INTERRUPT_COUNT | ||
|
||
/* the basic constants needed by gic */ | ||
rt_inline rt_uint32_t platform_get_gic_dist_base(void) | ||
{ | ||
rt_uint32_t gic_base; | ||
asm volatile ("mrc p15, 4, %0, c15, c0, 0" : "=r"(gic_base)); | ||
return gic_base + kGICDBaseOffset; | ||
} | ||
|
||
rt_inline rt_uint32_t platform_get_gic_cpu_base(void) | ||
{ | ||
rt_uint32_t gic_base; | ||
asm volatile ("mrc p15, 4, %0, c15, c0, 0" : "=r"(gic_base)); | ||
return gic_base + kGICCBaseOffset; | ||
} | ||
|
||
#define GIC_IRQ_START 0 | ||
|
||
#define GIC_ACK_INTID_MASK 0x000003ff | ||
|
||
/* the definition needed by gic.c */ | ||
#define __REG32(x) (*((volatile unsigned int *)(x))) | ||
|
||
/* keep compatible with platform SDK */ | ||
typedef enum { | ||
CPU_0, | ||
CPU_1, | ||
CPU_2, | ||
CPU_3, | ||
} cpuid_e; | ||
|
||
enum _gicd_sgi_filter | ||
{ | ||
//! Forward the interrupt to the CPU interfaces specified in the @a target_list parameter. | ||
kGicSgiFilter_UseTargetList = 0, | ||
|
||
//! Forward the interrupt to all CPU interfaces except that of the processor that requested | ||
//! the interrupt. | ||
kGicSgiFilter_AllOtherCPUs = 1, | ||
|
||
//! Forward the interrupt only to the CPU interface of the processor that requested the | ||
//! interrupt. | ||
kGicSgiFilter_OnlyThisCPU = 2 | ||
}; | ||
|
||
typedef void (*irq_hdlr_t) (void); | ||
|
||
extern void rt_hw_interrupt_mask(int vector); | ||
extern void rt_hw_interrupt_umask(int vector); | ||
extern rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, | ||
void *param, const char *name); | ||
|
||
rt_inline void register_interrupt_routine(uint32_t irq_id, irq_hdlr_t isr) | ||
{ | ||
rt_hw_interrupt_install(irq_id, (rt_isr_handler_t)isr, NULL, "unknown"); | ||
} | ||
|
||
rt_inline void enable_interrupt(uint32_t irq_id, uint32_t cpu_id, uint32_t priority) | ||
{ | ||
rt_hw_interrupt_umask(irq_id); | ||
} | ||
|
||
rt_inline void disable_interrupt(uint32_t irq_id, uint32_t cpu_id) | ||
{ | ||
rt_hw_interrupt_mask(irq_id); | ||
} | ||
|
||
#endif /* __IMX91_H__ */ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (c) 2025, Freescale Semiconductor, Inc. | ||
* All rights reserved. | ||
* | ||
* 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 HOLDER 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. | ||
*/ | ||
|
||
// File: iomux_config.c | ||
|
||
/* ------------------------------------------------------------------------------ | ||
* <auto-generated> | ||
* This code was generated by a tool. | ||
* Runtime Version:3.4.0.0 | ||
* | ||
* Changes to this file may cause incorrect behavior and will be lost if | ||
* the code is regenerated. | ||
* </auto-generated> | ||
* ------------------------------------------------------------------------------ | ||
*/ | ||
|
||
#include "iomux_config.h" | ||
|
||
// Function to configure iomux for i.MX91 board FRDM-i.MX91 | ||
void iomux_config(void) | ||
{ | ||
uart1_iomux_config(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.