打印

bootloader enable pin definition求救!

[复制链接]
2903|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
young_xyj|  楼主 | 2009-10-24 15:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 young_xyj 于 2009-10-24 15:58 编辑

我有一份bootloader代码,其定义的:
// bootloader enable pin definition
#define BL_ENABLE_PORT  GPIOD
#define BL_ENABLE_PIN   GPIO_PIN_2

我想问下所有的STM8S是否都是用这个管脚来判定是否导向升级?
说明我使用的是STM8S105C6是否也是用这个脚?

附上:
// detect if bootloader is enabled
  // enable pull-up on detect pin
  GPIO_Init(BL_ENABLE_PORT, BL_ENABLE_PIN, GPIO_MODE_IN_PU_NO_IT);
  // detect if pin is in high state - jumper not present = inactive bootloader
  if(GPIO_ReadInputData(BL_ENABLE_PORT) & GPIO_PIN_2)
  {
    //if user application is not virgin - valid reset vector jump
    if((*((@far u8*)MainUserApplication)==0x82) || (*((@far u8*)MainUserApplication)==0xAC))
    {
      GPIO_DeInit(BL_ENABLE_PORT); //de-init pull-up
      //reset stack pointer (lower byte - because compiler decreases SP with some bytes)
      _asm("LDW X,  SP ");
      _asm("LD  A,  $FF");
      _asm("LD  XL, A  ");
      _asm("LDW SP, X  ");
      
      // then jump to user application
      _asm("JPF [_MainUserApplication]");
      //MainUserApplication();  
    }
  }
沙发
香水城| | 2009-10-26 10:08 | 只看该作者
哪里搞来的bootloader代码?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

9

主题

30

帖子

1

粉丝