• 大小: 8.71MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-08
  • 语言: 其他
  • 标签: rt-thread  

资源简介

rt-thread,裸机移植的,小熊派stm32l431rc,配合本博客的操作步骤,实操rtt的祼机移植,虽然只是一个内核的移植,但可以帮助理解内核。

资源截图

代码片段和文件信息

/*
 * Copyright (c) 2006-2019 RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2017-07-24     Tanek        the first version
 * 2018-11-12     Ernest Chen  modify copyright
 */
 
#include 
#include 
#include 
#include “usart.h“

#define _SCB_base       (0xE000E010UL)
#define _SYSTICK_CTRL   (*(rt_uint32_t *)(_SCB_base + 0x0))
#define _SYSTICK_LOAD   (*(rt_uint32_t *)(_SCB_base + 0x4))
#define _SYSTICK_VAL    (*(rt_uint32_t *)(_SCB_base + 0x8))
#define _SYSTICK_CALIB  (*(rt_uint32_t *)(_SCB_base + 0xC))
#define _SYSTICK_PRI    (*(rt_uint8_t  *)(0xE000ED23UL))

// Updates the variable SystemCoreClock and must be called 
// whenever the core clock is changed during program execution.
extern void SystemCoreClockUpdate(void);

// Holds the system core clock which is the system clock 
// frequency supplied to the SysTick timer and the processor 
// core clock.
extern uint32_t SystemCoreClock;

static uint32_t _SysTick_Config(rt_uint32_t ticks)
{
    if ((ticks - 1) > 0xFFFFFF)
    {
        return 1;
    }
    
    _SYSTICK_LOAD = ticks - 1; 
    _SYSTICK_PRI = 0xFF;
    _SYSTICK_VAL  = 0;
    _SYSTICK_CTRL = 0x07;  
    
    return 0;
}

#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
#define RT_HEAP_SIZE 1024*10
static uint32_t rt_heap[RT_HEAP_SIZE];     // heap default size: 4K(1024 * 4)
RT_WEAK void *rt_heap_begin_get(void)
{
    return rt_heap;
}

RT_WEAK void *rt_heap_end_get(void)
{
    return rt_heap + RT_HEAP_SIZE;
}
#endif

/**
 * This function will initial your board.
 */
void rt_hw_board_init()
{
    /* System Clock Update */
    SystemCoreClockUpdate();
      MX_USART1_UART_Init();
    /* System Tick Configuration */
    _SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);

    /* Call components board initial (use INIT_BOARD_EXPORT()) */
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif

#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
    rt_system_heap_init(rt_heap_begin_get() rt_heap_end_get());
#endif
}

void rt_hw_console_output(const char *str)
{
 Usart_SendString((char *)str);
 printf(“\r\n“);
}

void SysTick_Handler(void)
{
    /* enter interrupt */
    rt_interrupt_enter();

    rt_tick_increase();
//printf(“%s“__FUNCTION__);
    /* leave interrupt */
    rt_interrupt_leave();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7496  2020-05-27 22:26  STM32L431RC_BearPiUART\.mxproject

     文件       2488  2020-05-28 22:30  STM32L431RC_BearPiUART\Board\board.c

     文件    1149034  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l431xx.h

     文件       7953  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\CMSIS\Device\ST\STM32L4xx\Include\stm32l4xx.h

     文件       2615  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\CMSIS\Device\ST\STM32L4xx\Include\system_stm32l4xx.h

     文件      28208  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_armcc.h

     文件      56497  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_armclang.h

     文件       9014  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_compiler.h

     文件      62344  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_gcc.h

     文件      28414  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_iccarm.h

     文件       1716  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\cmsis_version.h

     文件      97995  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_armv8mbl.h

     文件     168914  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_armv8mml.h

     文件      42208  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm0.h

     文件      50464  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm0plus.h

     文件      43456  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm1.h

     文件     104628  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm23.h

     文件     111854  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm3.h

     文件     175600  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm33.h

     文件     123607  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm4.h

     文件     148588  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_cm7.h

     文件      47249  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_sc000.h

     文件     110523  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\core_sc300.h

     文件      11711  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\mpu_armv7.h

     文件      10958  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\mpu_armv8.h

     文件       2757  2020-04-22 21:41  STM32L431RC_BearPiUART\Drivers\CMSIS\Include\tz_context.h

     文件     212906  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\STM32L4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h

     文件      34285  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_hal.h

     文件      18089  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_hal_cortex.h

     文件       7918  2020-04-22 21:45  STM32L431RC_BearPiUART\Drivers\STM32L4xx_HAL_Driver\Inc\stm32l4xx_hal_def.h

............此处省略270个文件信息

评论

共有 条评论