contiki移植

一、cc2538 -contiki keil启动文件

本人用keil官方提供的start.s文件进入不到man函数,会进入死循环,因此自己想从新更改分散加载文件和启动文件。


分散加载文件test.sct:

#! armcc -E


#define m_interrupts_start              0x200000
#define m_interrupts_size               0x0000028C

#define m_text_start                    0x200460
#define m_text_size                     0x0007F300

#define m_data_start                    0x20000000
#define m_data_size                     0x00008000

#define FlashCCA_start               0x0027FFD4
#define FlashCCA_size                12

/*-Sizes-*/
#define stack_size                      0x0200
#define heap_size                       0x0800

LR_m_text m_text_start m_text_size  {  ; load region size_region
  ER_m_text m_text_start m_text_size  { ; load address = execution address
 
   *(InRoot$$Sections)
   /**(KERNEL)*/
   .ANY (+RO)
  }
  RW_m_data m_data_start m_data_size-stack_size-heap_size  { ; RW data
   .ANY (+RW +ZI)
  }
  ARM_LIB_STACK m_data_start+m_data_size EMPTY -stack_size { ; Stack region growing down
  }
  ARM_LIB_HEAP m_data_start+m_data_size-stack_size-heap_size EMPTY heap_size { ; Heap region growing up
  }
}

LR_m_interrupts m_interrupts_start m_interrupts_size  {
  ER_m_interrupts m_interrupts_start m_interrupts_size  { ; load address = execution address
   .ANY (.vectortable,+FIRST)
  }
}
LR_FlashCCA FlashCCA_start FlashCCA_size  {
  ER_FlashCCA FlashCCA_start FlashCCA_size  { ; load address = execution address
   .ANY (.flashcca)
  }
}

启动文件:

/*
 *  Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
 *
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *    Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
/**
 * \addtogroup cc2538dk
 * @{
 *
 * \file
 * Startup code for the cc2538dk platform, to be used when building with gcc
 */



/*---------------------------------------------------------------------------*/


#include <stdint.h>
#include "contiki.h"
#include "reg.h"
  //#include "low_power_demo.h"
  //#include "llwu.h"
#define FLASH_START_ADDR                0x00200000
#define BOOTLOADER_BACKDOOR_DISABLE     0xEFFFFFFF
#define SYS_CTRL_EMUOVR                 0x400D20B4
  /* ISR prototype */
  extern unsigned           int Image$$ARM_LIB_STACK$$ZI$$Limit;

  
	
/*---------------------------------------------------------------------------*/
/* System Handler and ISR prototypes implemented elsewhere */
extern void clock_isr(void); /* SysTick Handler */
extern void uart_isr(void);
extern void gpio_port_a_isr(void);
extern void gpio_port_b_isr(void);
extern void gpio_port_c_isr(void);
extern void gpio_port_d_isr(void);
extern void rtimer_isr(void);
extern void cc2538_rf_rx_tx_isr(void);
extern void cc2538_rf_err_isr(void);
extern void udma_isr(void);
extern void udma_err_isr(void);
/*---------------------------------------------------------------------------*/
/* Weak interrupt handlers. Those containing a "mov r2" will load a value to
  CPU register r2, where the value is a constant indicating what fault was
  trapped. This makes debugging easier. */
/*---------------------------------------------------------------------------*/
void reset_handler( void );

void
nmi_handler(void)
{
  reset_handler();
/*  while(1);*/
}
/*---------------------------------------------------------------------------*/
 void
default_handler(void)
{
 
while(1);
}
/*---------------------------------------------------------------------------*/
 void
hf_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
mpu_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
busfault_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
usagefault_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
svcall_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
dbgmon_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
pendsv_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
uart1_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
ssi0_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
 void
i2c_handler(void)
{
while(1);
}
/*---------------------------------------------------------------------------*/
/* Link in the USB ISR only if USB is enabled */
#if USB_SERIAL_CONF_ENABLE
void usb_isr(void);
#else
#define usb_isr default_handler
#endif
/*---------------------------------------------------------------------------*/	
  /* Interrupt vector table type definition */
  typedef void (*const tIsrFunc)(void);
  typedef struct {
    void * __ptr;
    tIsrFunc __fun[162];
  } tVectorTable;
  
 // extern const tVectorTable __vect_table;
	/*---------------------------------------------------------------------------*/
__attribute__ ((section (".vectortable"))) const tVectorTable __vect_table __attribute__((used))  =
{
     /* ISR name                             No. Address      Pri Name                          Description */
    &Image$$ARM_LIB_STACK$$ZI$$Limit,  /* 0x00  0x00000000   -   ivINT_Initial_Stack_Pointer   used by PE */
 { 
	(tIsrFunc)&reset_handler,              /* Reset handler */
  (tIsrFunc)&nmi_handler,                /* The NMI handler */
  (tIsrFunc)&hf_handler,            /* The hard fault handler */
  (tIsrFunc)&mpu_handler,            /* 4 The MPU fault handler */
  (tIsrFunc)&busfault_handler,            /* 5 The bus fault handler */
  (tIsrFunc)&usagefault_handler,            /* 6 The usage fault handler */
  0,                          /* 7 Reserved */
  0,                          /* 8 Reserved */
  0,                          /* 9 Reserved */
  0,                          /* 10 Reserved */
  (tIsrFunc)&svcall_handler,            /* 11 SVCall handler */
  (tIsrFunc)&dbgmon_handler,            /* 12 Debug monitor handler */
  0,                          /* 13 Reserved */
  (tIsrFunc)&pendsv_handler,            /* 14 The PendSV handler */
  (tIsrFunc)&clock_isr,                  /* 15 The SysTick handler */
  (tIsrFunc)&gpio_port_a_isr,            /* 16 GPIO Port A */
  (tIsrFunc)&gpio_port_b_isr,            /* 17 GPIO Port B */
  (tIsrFunc)&gpio_port_c_isr,            /* 18 GPIO Port C */
  (tIsrFunc)&gpio_port_d_isr,            /* 19 GPIO Port D */
  0,                          /* 20 none */
  (tIsrFunc)&uart_isr,                   /* 21 UART0 Rx and Tx */
  (tIsrFunc)&uart1_handler,            /* 22 UART1 Rx and Tx */
  (tIsrFunc)&ssi0_handler,            /* 23 SSI0 Rx and Tx */
  (tIsrFunc)&i2c_handler,            /* 24 I2C Master and Slave */
  0,                          /* 25 Reserved */
  0,                          /* 26 Reserved */
  0,                          /* 27 Reserved */
  0,                          /* 28 Reserved */
  0,                          /* 29 Reserved */
  (tIsrFunc)&default_handler,            /* 30 ADC Sequence 0 */
  0,                          /* 31 Reserved */
  0,                          /* 32 Reserved */
  0,                          /* 33 Reserved */
  (tIsrFunc)&default_handler,            /* 34 Watchdog timer, timer 0 */
  (tIsrFunc)&default_handler,            /* 35 Timer 0 subtimer A */
  (tIsrFunc)&default_handler,            /* 36 Timer 0 subtimer B */
  (tIsrFunc)&default_handler,            /* 37 Timer 1 subtimer A */
  (tIsrFunc)&default_handler,            /* 38 Timer 1 subtimer B */
  (tIsrFunc)&default_handler,            /* 39 Timer 2 subtimer A */
  (tIsrFunc)&default_handler,            /* 40 Timer 2 subtimer B */
  (tIsrFunc)&default_handler,            /* 41 Analog Comparator 0 */
  (tIsrFunc)&default_handler,            /* 42 RFCore Rx/Tx (Alternate) */
  (tIsrFunc)&default_handler,            /* 43 RFCore Error (Alternate) */
  (tIsrFunc)&default_handler,            /* 44 System Control */
  (tIsrFunc)&default_handler,            /* 45 FLASH Control */
  (tIsrFunc)&default_handler,            /* 46 AES (Alternate) */
  (tIsrFunc)&default_handler,            /* 47 PKA (Alternate) */
  (tIsrFunc)&default_handler,            /* 48 SM Timer (Alternate) */
  (tIsrFunc)&default_handler,            /* 49 MacTimer (Alternate) */
  (tIsrFunc)&default_handler,            /* 50 SSI1 Rx and Tx */
  (tIsrFunc)&default_handler,            /* 51 Timer 3 subtimer A */
  (tIsrFunc)&default_handler,            /* 52 Timer 3 subtimer B */
  0,                          /* 53 Reserved */
  0,                          /* 54 Reserved */
  0,                          /* 55 Reserved */
  0,                          /* 56 Reserved */
  0,                          /* 57 Reserved */
  0,                          /* 58 Reserved */
  0,                          /* 59 Reserved */
  0,                          /* 60 Reserved */
  0,                          /* 61 Reserved */
  (tIsrFunc)&udma_isr,                   /* 62 uDMA */
  (tIsrFunc)&udma_err_isr,               /* 63 uDMA Error */
  0,                          /* 64 64-155 are not in use */
  0,                          /* 65 */
  0,                          /* 66 */
  0,                          /* 67 */
  0,                          /* 68 */
  0,                          /* 69 */
  0,                          /* 70 */
  0,                          /* 71 */
  0,                          /* 72 */
  0,                          /* 73 */
  0,                          /* 74 */
  0,                          /* 75 */
  0,                          /* 76 */
  0,                          /* 77 */
  0,                          /* 78 */
  0,                          /* 79 */
  0,                          /* 80 */
  0,                          /* 81 */
  0,                          /* 82 */
  0,                          /* 83 */
  0,                          /* 84 */
  0,                          /* 85 */
  0,                          /* 86 */
  0,                          /* 87 */
  0,                          /* 88 */
  0,                          /* 89 */
  0,                          /* 90 */
  0,                          /* 91 */
  0,                          /* 92 */
  0,                          /* 93 */
  0,                          /* 94 */
  0,                          /* 95 */
  0,                          /* 96 */
  0,                          /* 97 */
  0,                          /* 98 */
  0,                          /* 99 */
  0,                          /* 100 */
  0,                          /* 101 */
  0,                          /* 102 */
  0,                          /* 103 */
  0,                          /* 104 */
  0,                          /* 105 */
  0,                          /* 106 */
  0,                          /* 107 */
  0,                          /* 108 */
  0,                          /* 109 */
  0,                          /* 110 */
  0,                          /* 111 */
  0,                          /* 112 */
  0,                          /* 113 */
  0,                          /* 114 */
  0,                          /* 115 */
  0,                          /* 116 */
  0,                          /* 117 */
  0,                          /* 118 */
  0,                          /* 119 */
  0,                          /* 120 */
  0,                          /* 121 */
  0,                          /* 122 */
  0,                          /* 123 */
  0,                          /* 124 */
  0,                          /* 125 */
  0,                          /* 126 */
  0,                          /* 127 */
  0,                          /* 128 */
  0,                          /* 129 */
  0,                          /* 130 */
  0,                          /* 131 */
  0,                          /* 132 */
  0,                          /* 133 */
  0,                          /* 134 */
  0,                          /* 135 */
  0,                          /* 136 */
  0,                          /* 137 */
  0,                          /* 138 */
  0,                          /* 139 */
  0,                          /* 140 */
  0,                          /* 141 */
  0,                          /* 142 */
  0,                          /* 143 */
  0,                          /* 144 */
  0,                          /* 145 */
  0,                          /* 146 */
  0,                          /* 147 */
  0,                          /* 148 */
  0,                          /* 149 */
  0,                          /* 150 */
  0,                          /* 151 */
  0,                          /* 152 */
  0,                          /* 153 */
  0,                          /* 154 */
  0,                          /* 155 */
  (tIsrFunc)&usb_isr,                    /* 156 USB */
  (tIsrFunc)&cc2538_rf_rx_tx_isr,        /* 157 RFCORE RX/TX */
  (tIsrFunc)&cc2538_rf_err_isr,          /* 158 RFCORE Error */
  (tIsrFunc)&default_handler,            /* 159 AES */
  (tIsrFunc)&default_handler,            /* 160 PKA */
  (tIsrFunc)&rtimer_isr,                 /* 161 SM Timer */
  (tIsrFunc)&default_handler            /* 162 MACTimer */
}
};
/*---------------------------------------------------------------------------*/
/*
 * Customer Configuration Area in the Lock Page
 * Holds Image Vector table address (bytes 2012 - 2015) and
 * Image Valid bytes (bytes 2008 -2011)
 */
typedef struct {
  unsigned long bootldr_cfg;
  unsigned long image_valid;
  unsigned long image_vector_addr;
} lock_page_cca_t;
/*---------------------------------------------------------------------------*/

__attribute__ ((section (".flashcca")))  __attribute__((used)) 
const lock_page_cca_t __cca =
{
  BOOTLOADER_BACKDOOR_DISABLE, /* Bootloader backdoor disabled */
  0,                           /* Image valid bytes */
  FLASH_START_ADDR             /* Vector table located at the start of flash */
};
/*---------------------------------------------------------------------------*/

	


 
__asm void reset_handler(void) {

  IMPORT  __main
  LDR     R0, =__main
  BX      R0
  ALIGN 4
}
/*---------------------------------------------------------------------------*/
/** @} */



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值