三木社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 638|回复: 0

[例程] sm14z2538移植1-添加CPU相关代码6

[复制链接]

1562

主题

1564

帖子

4904

积分

博士

Rank: 8Rank: 8

积分
4904
发表于 2017-10-10 09:40:23 | 显示全部楼层 |阅读模式
15.添加flash.c文件,代码如下:
  1. /*
  2. *  Copyright (c) 2016, The OpenThread Authors.
  3. *  All rights reserved.
  4. *
  5. *  Redistribution and use in source and binary forms, with or without
  6. *  modification, are permitted provided that the following conditions are met:
  7. *  1. Redistributions of source code must retain the above copyright
  8. *     notice, this list of conditions and the following disclaimer.
  9. *  2. Redistributions in binary form must reproduce the above copyright
  10. *     notice, this list of conditions and the following disclaimer in the
  11. *     documentation and/or other materials provided with the distribution.
  12. *  3. Neither the name of the copyright holder nor the
  13. *     names of its contributors may be used to endorse or promote products
  14. *     derived from this software without specific prior written permission.
  15. *
  16. *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17. *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  19. *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  20. *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  21. *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  22. *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  23. *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  24. *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  25. *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  26. *  POSSIBILITY OF SUCH DAMAGE.
  27. */

  28. /**
  29. * @file
  30. *   This file implements gcc-specific startup code for the cc2538.
  31. */

  32. #include <stdint.h>

  33. #define FLASH_CCA_BOOTLDR_CFG_DISABLE           0xEFFFFFFF ///< Disable backdoor function
  34. #define FLASH_CCA_BOOTLDR_CFG_ENABLE            0xF0FFFFFF ///< Enable backdoor function
  35. #define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH       0x08000000 ///< Selected pin on pad A active high
  36. #define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M      0x07000000 ///< Selected pin on pad A mask
  37. #define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S      24         ///< Selected pin on pad A shift
  38. #define FLASH_CCA_IMAGE_VALID                   0x00000000 ///< Indicates valid image in flash

  39. #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN  3      ///< Select Button on SmartRF06 Eval Board

  40. typedef struct
  41. {
  42.     uint32_t ui32BootldrCfg;
  43.     uint32_t ui32ImageValid;
  44.     uint32_t ui32ImageVectorAddr;
  45.     uint8_t  ui8lock[32];
  46. } flash_cca_lock_page_t;

  47. extern void *_vector_table[];

  48. __attribute__((__section__(".flashcca"), used))
  49. const flash_cca_lock_page_t flash_cca_lock_page =
  50. {
  51.     FLASH_CCA_BOOTLDR_CFG_ENABLE | (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S),
  52.     FLASH_CCA_IMAGE_VALID,
  53.     (uint32_t) &_vector_table,
  54.     {
  55.         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  56.         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  57.         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  58.         0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
  59.     }
  60. };
复制代码


回复

使用道具 举报

Archiver|手机版|小黑屋|三木电子社区 ( 辽ICP备11000133号-4 )

辽公网安备 21021702000620号

GMT+8, 2025-11-18 19:08 , Processed in 0.027202 second(s), 23 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表