当前位置: 首页 > news >正文

东莞万江网站建设网站 制作 中心

东莞万江网站建设,网站 制作 中心,wordpress屏蔽字体,南京网站设计与制作上电过程 上电后,CPU从固定的位置读取复位向量。 这个固定的位置就是0xFFFE。是芯片厂商出厂时预设好的。 这个地址是NON_BANKED的。这个位置保存的是复位向量,实际上就是一个函数指针。该函数指针指向_Startup()函数。 map文件: 注意:程序…

上电过程

上电后,CPU从固定的位置读取复位向量。

这个固定的位置就是0xFFFE。是芯片厂商出厂时预设好的。

这个地址是NON_BANKED的。这个位置保存的是复位向量,实际上就是一个函数指针。该函数指针指向_Startup()函数。

map文件:

注意:程序的入口点是_Startup,不是main()。

_Startup函数是存放在0xC000位置。而0xFFFE地址的值就是0xC000.

S19文件:

_Startup()函数分析

打开 Start12.c文件,可以看到_Startup()函数。

/* The function _Startup must be called in order to initialize global variables and to call main */
/* You can adapt this function or call it from your startup code to implement a different startup */
/* functionality. *//* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */
/* on hardware *//* to set the reset vector several ways are possible : */
/* 1. define the function with "interrupt 0" as done below in the first case */
/* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */
/* of course, even more posibilities exists */
/* the reset vector must be set so that the application has a defined entry point */#if defined(__SET_RESET_VECTOR__)
__EXTERN_C void __interrupt 0 _Startup(void) {
#else
__EXTERN_C void _Startup(void) {
#endif
/*  purpose:    1)  initialize the stack2)  initialize the RAM, copy down init data etc (Init)3)  call main;parameters: NONEcalled from: _PRESTART-code generated by the Linkeror directly referenced by the reset vector *//* initialize the stack pointer */INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */#if defined(_HCS12_SERIALMON)/* for Monitor based software remap the RAM & EEPROM to adhereto EB386. Edit RAM and EEPROM sections in PRM file to match these. */___INITRG = 0x00;  /* lock registers block to 0x0000 */___INITRM = 0x39;  /* lock Ram to end at 0x3FFF */___INITEE = 0x09;  /* lock EEPROM block to end at 0x0fff */
#endif/* Here user defined code could be inserted, the stack could be used */
#if defined(_DO_DISABLE_COP_)_DISABLE_COP();
#endif/* Example : Set up WinDef Register to allow Paging */
#ifdef HC812A4 /* HC12 A4 derivative needs WINDEF to configure which pages are available */
#if  (__ENABLE_EPAGE__ != 0 ||  __ENABLE_DPAGE__ != 0 || __ENABLE_PPAGE__ != 0)WINDEF= __ENABLE_EPAGE__ | __ENABLE_DPAGE__  | __ENABLE_PPAGE__;
#endif
#endif#if (defined(__MAP_RAM__) || defined(__MAP_FLASH__) || defined(__MAP_EXTERNAL__)) && !defined(__DO_SET_MMCTL1__)
#define __DO_SET_MMCTL1__
#endif#if defined(__DO_SET_MMCTL1__)/* Set the MMCTL1 byte. Please use for HCS12XE and change the bits according   *//* to your configuration.                                                      *//* Note: MMCTL1 is write once therefore please adapt this initialization here. *//* This has to be done prior to the call to Init.                              */
#define _MMCTL1_ADR (0x00000013)
#define _MMCTL1_BIT_TGMRAMON (1<<7)  /* EEE Tag RAM and FTM SCRATCH RAM visible in the memory map */
#define _MMCTL1_BIT_EEEIFRON (1<<5)  /* EEE IFR visible in the memory map                         */
#define _MMCTL1_BIT_PGMIFRON (1<<4)  /* Program IFR visible in the memory map                     */
#define _MMCTL1_BIT_RAMHM    (1<<3)  /* RAM only in the higher half of the memory map             */
#define _MMCTL1_BIT_EROMON   (1<<2)  /* Enables emulated Flash or ROM memory in the memory map    */
#define _MMCTL1_BIT_ROMHM    (1<<1)  /* FLASH or ROM only in higher Half of Memory Map            */
#define _MMCTL1_BIT_ROMON    (1<<0)  /* Enable FLASH or ROM in the memory map                     */#define _MMCTL1_SET(value)   ((*(volatile unsigned char*)_MMCTL1_ADR)= (value))#if defined(__MAP_FLASH__)_MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON);
#elif defined(__MAP_EXTERNAL__)_MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON | _MMCTL1_BIT_ROMHM);
#else /* RAM */_MMCTL1_SET(_MMCTL1_BIT_ROMON | _MMCTL1_BIT_EROMON | _MMCTL1_BIT_RAMHM | _MMCTL1_BIT_ROMHM);
#endif    
#endif#ifndef __ONLY_INIT_SPInit(); /* zero out, copy down, call constructors */
#endif/* Here user defined code could be inserted, all global variables are initilized */
#if defined(_DO_ENABLE_COP_)_ENABLE_COP(1);
#endif/* call main() */main();
}

其实,删除掉各种define,去繁存精,只干了三件事:设置栈指针SP,调用init(),然后调用main()。

从map文件中也可以验证:

BOOTLOADER设计

在有BOOT的系统中,程序分为两部分:BOOT和APP。

这里面就有两套中断。需要在BOOT中做特殊处理。

在升级过程中,接收到上位机发过来的APP的bin文件时,需要调整中断向量保存的位置。(因为APP工程中生成的中断向量也是保存在0xFF10开始的位置)

上电后,CPU还是先从BOOT开始执行。在BOOT中作一些判断,确认APP正常后,跳转到APP中去执行。但是在跳转前,需要先配置中断向量基地址寄存器(IVBR),确保中断向量指向正确的位置。

注意:IVBR是个8位的寄存器,而中断向量起始地址是16位的,其中低8位默认为0.

http://www.dtcms.com/a/430301.html

相关文章:

  • 网站开发php学校智通人才网
  • 建设银行网站如何修改账单地址如何提升网站的权重
  • 怎么样建一个网站wordpress内部优化
  • 漳州找人做网站要求哪些福建企业seo推广
  • 网站备案需要关站互联网软件公司排名
  • 网站开发毕设文档河北邯郸大风
  • 企业网站建设457支付网站开发费可以做无形资产
  • 无锡高端网站建设公司wordpress弹窗下载页面
  • 龙岗区网站建设什么网站做外贸最好
  • 微商网站开发一元手游平台app
  • 毕设网站开发什么题目好南沙网站建设价格
  • 公司网站开发的国内外研究现状搜索引擎收录入口
  • 铁岭网站建设公司建网站的公司
  • 怀化新站优化html5 的网站
  • 信贷员在哪个网站做推广网站预算表怎么做
  • 如何做优秀的游戏视频网站公司自己买服务器建设网站
  • 威县做网站哪家便宜张家港百度网站推广
  • 哈尔滨论坛建站模板深圳龙华招聘信息
  • php做的汽车销售网站比较好用的微信社群管理软件
  • 域名注册了如何做网站手机怎么生成网站
  • 网站后台插件学网站开发顺序
  • 北京网站建设外包公司wordpress换背景插件
  • 陕西省建设监理协会网站主页商城网站技术方案
  • 网站首页优化方案百度官方电话人工服务电话
  • js商城网站可以做请柬的网站
  • 工商局网站清算组备案怎么做wordpress外链内链
  • 怎样做网站的优化、排名网站系统建设
  • ps网站首页怎么设计西安网站建设培训班
  • 网站建设买服务器还是数据库建筑网站资料排行榜
  • 用什么网站能直接做dj怎么做网页自我介绍