Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
皆さんこんにちは。mbed初心者です。
勉強のためにオフライン環境にてプログラムを一から作成し実行しようとしているのですが、うまく実行できません。
プログラム自体はLED1を点灯させるだけの単純なものなのですが、それでも点灯させられず、いろいろ試行錯誤を繰り返してきたのですがどこが悪いのかまったくわかりません。
有識者殿、何が悪いのかご教示いただけますでしょうか?
オフライン環境、ソースコード、コンパイルから実行までの流れを下記に示します。
オフライン環境
コンパイルから実行までの流れ
$ arm-none-eabi-objcopy -O binary mbed_LED_TEST.elf mbed_LED_TEST.bin
ソースコード等
Link.ld
MEMORY { flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K lram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K ram (rwx) : ORIGIN = 0x2007C000, LENGTH = 32K } SECTIONS { . = 0x0; /* from 0x00000000 */ .text : { _stext = .; *(.vectors) *(.text*) *(.rodata*) _etext = .; } > flash .data : { _sdata_la = LOADADDR(.data); _sdata = .; *(.data*) _edata = .; } > flash .bss : { _sbss = .; *(.bss*) *(COMMON*) _ebss = .; } > flash .heap : { _heap = .; } > lram .stack : { _stack = 0x10007ffc; } > lram }vectors.c
#define __stack 0x10007ffc extern void rst_handler(void); extern void nmi_handler(void); extern void hardfault_handler(void); #define NULL 0x0 // Define vector table (256 word) __attribute__((section(".vectors"))) void (* const VectorArray[])(void) = { __stack, rst_handler, nmi_handler, &hardfault_handler, NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL, NULL,NULL };int_handler.c
extern int main(void); void rst_handler(void) { main(); return; }; void nmi_handler(void) { return; }; void hardfault_handler(void) { return; };main.c
#define PORT1_DIR 0x2009C020 #define P18 (0x1 << 18) int main(void) { static unsigned int* pAddr = (unsigned int*)(PORT1_DIR); *pAddr = P18; while(1); return(0); }