• 大小: 171KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: 其他
  • 标签:

资源简介

飞思卡尔智能车设计大赛基于K60的PWM波产生程序,用IAR进行编程。

资源截图

代码片段和文件信息

//-------------------------------------------------------------------------*
// 文件名:start.c                                                          *
// 说  明: CPU启动后进行系统配置                                           *
//-------------------------------------------------------------------------*

//头文件
#include “common.h“
#include “wdog.h“
//#include “sysinit.h“

#pragma section = “.data“
#pragma section = “.data_init“
#pragma section = “.bss“
#pragma section = “CodeRelocate“
#pragma section = “CodeRelocateRam“ 

//内部函数声明
//-------------------------------------------------------------------------*
//函数名: common_startup                                                   *
//功  能: 复制中断向量表到RAM中                                            * 
//参  数: 无    *
//说  明: 将ROM中的初始化数据拷贝到RAM中                                   *
//-------------------------------------------------------------------------*
void common_startup(void);

//-------------------------------------------------------------------------*
//函数名: start                                                            *
//功  能: 系统启动                                                         * 
//参  数: 无    *
//说  明: 无                                                               *
//-------------------------------------------------------------------------*
void start(void)
{
    //关闭看门狗
    wdog_disable();
    //复制中断向量表到RAM中
    common_startup();
    //进入主函数
    main();
}


//-------------------------------------------------------------------------*
//函数名: common_startup                                                   *
//功  能: 复制中断向量表到RAM中                                            * 
//参  数: 无    *
//说  明: 将ROM中的初始化数据拷贝到RAM中                                   *
//-------------------------------------------------------------------------*
void common_startup(void)
{
    /* Declare a counter we‘ll use in all of the copy loops */
    uint32 n;
 
 
    /* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */  
    extern uint32 __VECTOR_TABLE[];
    extern uint32 __VECTOR_RAM[];

    /* Copy the vector table to RAM */
    if (__VECTOR_RAM != __VECTOR_TABLE)
    {
        for (n = 0; n < 0x410; n++)
            __VECTOR_RAM[n] = __VECTOR_TABLE[n];
    }
    /* Point the VTOR to the new copy of the vector table */
    write_vtor((uint32)__VECTOR_RAM);    
    
    /* Get the addresses for the .data section (initialized data section) */
    uint8* data_ram = __section_begin(“.data“);
    uint8* data_rom = __section_begin(“.data_init“);
    uint8* data_rom_end = __section_end(“.data_init“);
    
    /* Copy initialized data from ROM to RAM */
    n = data_rom_end - data_rom;
    while (n--)
      *data_ram++ = *data_rom++;
 
 
    /* Get the addresses for the .bss section (zero-initialized data) */
    uint8* bss_start = __section_begin(“.bss“);
    uint8* bss_end = __section_end(“.bss“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\
     文件       38151  2016-10-25 09:04  LQ_K60_FTM_PWM_LED\LQ_K60_FTM_PWM_LED.dep
     文件       74756  2016-09-01 09:35  LQ_K60_FTM_PWM_LED\LQ_K60_FTM_PWM_LED.ewd
     文件       56309  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\LQ_K60_FTM_PWM_LED.ewp
     文件        8927  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\LQ_K60_FTM_PWM_LED.ewt
     文件         172  2016-10-25 09:03  LQ_K60_FTM_PWM_LED\LQ_K60_FTM_PWM_LED.eww
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\src\
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\src\Includes\
     文件        4739  2016-10-24 10:37  LQ_K60_FTM_PWM_LED\src\Includes\ADC.h
     文件        5987  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\common.h
     文件         749  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\DAC.h
     文件        7424  2016-10-24 10:38  LQ_K60_FTM_PWM_LED\src\Includes\DMA.h
     文件        3167  2016-10-24 10:38  LQ_K60_FTM_PWM_LED\src\Includes\FTM.h
     文件        3204  2016-10-24 10:38  LQ_K60_FTM_PWM_LED\src\Includes\GPIO.h
     文件       29244  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\GPIO_Cfg.h
     文件        2523  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\I2C.h
     文件        2089  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\Lptmr.h
     文件         889  2016-10-24 10:19  LQ_K60_FTM_PWM_LED\src\Includes\LQKEY.h
     文件         945  2016-10-24 10:19  LQ_K60_FTM_PWM_LED\src\Includes\LQLED.h
     文件         937  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\PIT.h
     文件        1160  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\PLL.h
     文件        2749  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\UART.h
     文件       19927  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\vectors.h
     文件        1537  2016-10-24 10:45  LQ_K60_FTM_PWM_LED\src\Includes\wdog.h
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\src\Libs\
     文件      816525  2015-10-23 12:03  LQ_K60_FTM_PWM_LED\src\Libs\MK60N512VMD100.h
     目录           0  2015-12-27 10:24  LQ_K60_FTM_PWM_LED\src\Output\
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\src\Project_Setting\
     目录           0  2017-12-01 19:51  LQ_K60_FTM_PWM_LED\src\Project_Setting\linker_Files\
     文件        2035  2012-02-28 15:33  LQ_K60_FTM_PWM_LED\src\Project_Setting\linker_Files\128KB_Ram.icf
     文件        2024  2010-10-28 03:30  LQ_K60_FTM_PWM_LED\src\Project_Setting\linker_Files\64KB_Ram.icf
............此处省略29个文件信息

评论

共有 条评论

相关资源