Ext_RAM.ini 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /******************************************************************************/
  2. /* Ext_RAM.INI: External RAM (SDRAM) Initialization File */
  3. /******************************************************************************/
  4. // <<< Use Configuration Wizard in Context Menu >>> //
  5. /******************************************************************************/
  6. /* This file is part of the uVision/ARM development tools. */
  7. /* Copyright (c) 2005-2008 Keil Software. All rights reserved. */
  8. /* This software may only be used under the terms of a valid, current, */
  9. /* end user licence from KEIL for a compatible version of KEIL software */
  10. /* development tools. Nothing else gives you the right to use this software. */
  11. /******************************************************************************/
  12. FUNC void SetupForStart (void) {
  13. // <o> Program Entry Point
  14. PC = 0x30000000;
  15. }
  16. FUNC void Init (void) {
  17. _WDWORD(0x4A000008, 0xFFFFFFFF); // Disable All Interrupts
  18. _WDWORD(0x53000000, 0x00000000); // Disable Watchdog Timer
  19. // Clock Setup
  20. // FCLK = 300 MHz, HCLK = 100 MHz, PCLK = 50 MHz
  21. _WDWORD(0x4C000000, 0x0FFF0FFF); // LOCKTIME
  22. _WDWORD(0x4C000014, 0x0000000F); // CLKDIVN
  23. _WDWORD(0x4C000004, 0x00043011); // MPLLCON
  24. _WDWORD(0x4C000008, 0x00038021); // UPLLCON
  25. _WDWORD(0x4C00000C, 0x001FFFF0); // CLKCON
  26. // Memory Controller Setup for SDRAM
  27. _WDWORD(0x48000000, 0x22000000); // BWSCON
  28. _WDWORD(0x4800001C, 0x00018005); // BANKCON6
  29. _WDWORD(0x48000020, 0x00018005); // BANKCON7
  30. _WDWORD(0x48000024, 0x008404F3); // REFRESH
  31. _WDWORD(0x48000028, 0x00000032); // BANKSIZE
  32. _WDWORD(0x4800002C, 0x00000020); // MRSRB6
  33. _WDWORD(0x48000030, 0x00000020); // MRSRB7
  34. _WDWORD(0x56000000, 0x000003FF); // GPACON: Enable Address lines for SDRAM
  35. }
  36. // Reset chip with watchdog, because nRST line is routed on hardware in a way
  37. // that it can not be pulled low with ULINK
  38. _WDWORD(0x40000000, 0xEAFFFFFE); // Load RAM addr 0 with branch to itself
  39. CPSR = 0x000000D3; // Disable interrupts
  40. PC = 0x40000000; // Position PC to start of RAM
  41. _WDWORD(0x53000000, 0x00000021); // Enable Watchdog
  42. g, 0 // Wait for Watchdog to reset chip
  43. Init(); // Initialize memory
  44. LOAD rtthread-mini2440.axf INCREMENTAL // Download program
  45. SetupForStart(); // Setup for Running
  46. g, main // Goto Main