https://armkeil.blob.core.windows.net/eval/MDK531.EXE
https://armkeil.blob.core.windows.net/legacy/MDK79525.EXE
准备 RAM.ini
FUNC void Setup (void) { PC = 0x00200000; } _WDWORD(0xFFFFFD44, 0x00008000); // WDT_WDMR: Disable Watchdog // Switching from Slow Clock to Main Oscillator for faster Download _WDWORD(0xFFFFFC20, 0x00000601); // PMC_MOR: Enable Main Oscillator _sleep_(10); // Wait for stable Main Oscillator _WDWORD(0xFFFFFC30, 0x00000001); // PMC_MCKR: Switch to Main Oscillator LOAD %L INCREMENTAL // Download Setup(); // Setup for Running g, main准备Main.c
此应用是一个MCU的hello world, 用GPIO驱动LED闪烁
#include "AT91SAM7S256.h" #define LED_A (1U<<0) // PA0, pin 48 #define LED_B (1U<<1) // PA1, pin 47 void sleep_ms(unsigned int msec) { volatile unsigned int i; for (i = 0; i < 1000 * msec; i++) { __asm ("NOP"); } } int main(void) { /* Configure the pins as outputs */ AT91C_BASE_PIOA->PIO_OER = (LED_A | LED_B); /* Enable PIOC control on the pins*/ AT91C_BASE_PIOA->PIO_PER = (LED_A | LED_B); /* Disable pull-ups */ AT91C_BASE_PIOA->PIO_PPUDR = (LED_A | LED_B); while(1) { /* Turn LED on, high level */ AT91C_BASE_PIOA->PIO_SODR = LED_A; sleep_ms(1); /* Turn LED off, low level */ AT91C_BASE_PIOA->PIO_CODR = LED_A; sleep_ms(1); } }开启MDK,新建Project,选择存储位置
![](https://softs.im/wp-content/uploads/2020/08/RAM-1.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-2.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-3.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-4.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-5.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-6.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-7.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-8.png)
选中 Use ULink2/ME ARM Debugger, 取消 选择 Load Application at Startup, 添加Initilization File, 选择 RAM.ini
![](https://softs.im/wp-content/uploads/2020/08/RAM-9.png)
![](https://softs.im/wp-content/uploads/2020/08/RAM-10.png)