Presentation is loading. Please wait.

Presentation is loading. Please wait.

AT91Bootstrap. Introduction Device initialization such as clock speed configuration, PIO settings, etc. Peripheral drivers such as PIO, PMC, SDRAMC, etc.

Similar presentations


Presentation on theme: "AT91Bootstrap. Introduction Device initialization such as clock speed configuration, PIO settings, etc. Peripheral drivers such as PIO, PMC, SDRAMC, etc."— Presentation transcript:

1 AT91Bootstrap

2 Introduction Device initialization such as clock speed configuration, PIO settings, etc. Peripheral drivers such as PIO, PMC, SDRAMC, etc. Physical media algorithms such as DataFlash®, NANDFlash, Parallel Flash, etc. File System drivers such as JFFS2, FAT, etc. Compression and Cipher algorithms Application Launcher for ELF, Linux®, etc.

3 Peripheral Drivers PIO PIOA controller handles pin_number from 0 to 31 PIOB controller handles pin_number from 32 to 61 PIOC controller handles pin from 62 to 95 /* Convert Pin Number into PIO controller index */ static inline unsigned pin_to_controller(unsigned pin) { return (pin) / 32; }

4 pio_desc Structure Table. pio_desc Structure Table. pio_type Enumeration Table. PIO Attributes

5 pio_desc Structure Example. const struct pio_desc hw_pio[] = { {"RXD", AT91C_PIN_PA(9), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"TXD", AT91C_PIN_PA(10), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"", 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, };

6 pio_setup() Function Table. pio_setup() Function Example. const struct pio_desc hw_pio[] = { {"PCK0", AT91C_PIN_PA(7), 0, PIO_DEFAULT, PIO_PERIPH_B}, {"PCK1", AT91C_PIN_PA(8), 0, PIO_DEFAULT, PIO_PERIPH_B}, {"", 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, }; /* Configure the PIO controller to output PCK0 */ pio_setup(hw_pio);

7 pio_get_value() Function pio_set_value() Function Table. pio_get_value() Function Table. pio_set_gpio_value() Function

8 /* Device specific... */ #define PIO_TEST_OUT AT91C_PIN_PA(7) #define PIO_TEST_IN AT91C_PIN_PA(8) /* Device non specific... */ const struct pio_desc hw_pio[] = { {"TEST_OUT", PIO_TEST_OUT, 0, PIO_DEFAULT, PIO_OUTPUT}, {"TEST_IN", PIO_TEST_IN, 0, PIO_DEGLITCH, PIO_INPUT}, {"", 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, }; /* Configure the PIO controller to output PCK0 */ pio_setup(hw_pio); /* Test the default value */ if (pio_get_value(PIO_TEST_IN) == 1) return 0; /* Return failed */ /* Force a high level on PIO_TEST_OUT pin */ pio_set_value(PIO_TEST_OUT, 1); /* Test the default value */ if (pio_get_value(PIO_TEST_IN) == 0) return 0; /* Return failed */ return 1; /* Success */ Example.

9 PMC /* Automatically generated using... */ #define PMC_PLLAR 0x12345678 /* MOSC = 18.423Mhz,MUL =,DIV = */ #define PMC_PLLBR 0x12345678 /* MOSC = 18.423Mhz, MUL =,DIV = */ #define PMC_MCKR 0x12345678 /* MCK = PLLA */ #define PLL_TIMEOUT 1000000 /* Configure PLLA */ if (!pmc_cfg_plla(PMC_PLLAR, PLL_TIMEOUT)) goto pmc_error; /* Switch MCK on PLLA output PCK = PLLA = 2 * MCK */ if (!pmc_cfg_mck(PMC_MCKR, PLL_TIMEOUT)) goto pmc_error; /* Configure PLLB */ if (!pmc_cfg_pllb(PMC_PLLBR, PLL_TIMEOUT)) goto pmc_error; pmc_error: /* Reset the device*/

10 pmc_cfg_plla() Function pmc_cfg_pllb() Function Table. pmc_cfg_plla()function Table. pmc_cfg_pllb()function

11 pmc_cfg_mck() Function pmc_cfg_pck() Function Table. pmc_cfg_mck()function

12 SDRAMC Prerequisite CFG_SDRAM and CFG_HW_INIT flags must be defined in your board project header file. Example: Define these flags in board/at91sam9260ek/dataflash/at91sam9260ek.h Create a function sdramc_hw_init() in your board source file. Example: Define this function in board/at91sam9260ek/at91sam9260ek.c

13 sdramc_hw_init() Function #ifdef CFG_SDRAM void sdramc_hw_init(void) { const struct pio_desc sdramc_pio[] = { {"D0", AT91C_PIN_PC(16), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"D1", AT91C_PIN_PC(17), 0, PIO_DEFAULT, PIO_PERIPH_A},. {"D15", AT91C_PIN_PC(31), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"", 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, }; /* Configure the PIO controller to enable 32-bits SDRAM */ pio_setup(sdramc_pio); } #endif Prototype: void sdramc_hw_init(void)

14 sdramc_init() Function Table. sdramc_init() Function

15 DBGU Prerequisite CFG_DEBUG and CFG_HW_INIT flags must be defined in your board project header file. Example: Define these flags in board/at91sam9260ek/dataflash/at91sam9261ek.h

16 dbg_init() Function Table. dbg_init() Function dbg_print() Function Table. dbg_print() Function

17 DataFlash Prerequisite CFG_DATAFLASH flag must be defined in your board project header file. Example: Define this flag in board/at91sam9260ek/dataflash/at91sam9260ek.h Create a function df_hw_init() in your board source file Example: Define this function in board/at91sam9260ek/at91sam9260ek.c

18 df_hw_init() Function Prototype: void df_hw_init(void) #ifdef CFG_DATAFLASH void df_hw_init(void) { const struct pio_desc df_pio[] = { {"MISO", AT91C_PIN_PA(0), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"MOSI", AT91C_PIN_PA(1), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"SPCK", AT91C_PIN_PA(2), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"NPCS0", AT91C_PIN_PA(3), 0, PIO_DEFAULT, PIO_PERIPH_A}, {"", 0, 0, PIO_DEFAULT, PIO_PERIPH_A}, }; /* Configure the PIO controller to enable SPI DataFlash*/ pio_setup(df_pio); } #endif

19 load_df() Function Table. load_df()function

20 NAND Flash Prerequisite CFG_NANDFLASH flag must be defined in your board project header file. Example: Define this flag in board/at91sam9260ek/nandflash/at91sam9260ek.h Create nandflash_hw_init() and nandflash_cfg_16bits_dbw_init() in your board source file. Example: Define this function in board/at91sam9260ek/at91sam9260ek.c

21 nandflash_hw_init() Function PIOs used by the NAND Flash SMC timings HMatrix or Chip Configuration User Interface Prototype: void nandflash_hw_init(void)

22 nandflash_cfg_16bits_dbw_init() Function #ifdef CFG_NANDFLASH void nandflash_cfg_16bits_dbw_init(void) { writel(readl(AT91C_BASE_SMC + SMC_CTRL3) | AT91C_SMC_DBW_WIDTH_SIXTEEN_BITS, AT91C_BASE_SMC + SMC_CTRL3); } #endif Example.

23 load_nandflash() Function Table. load_nandflash()function

24 NAND Flash Features Large Blocks vs. Small Blocks Large Block NAND Flash: parts bigger than 1 Gbit Small Block NAND Flash: parts smaller than 1 Gbit Example. #define CFG_NANDFLASH /* Enable DataFlash Download */ #define NANDFLASH_SMALL_BLOCKS /*Small Block NandFlash used */

25

26 Compiling an AT91Bootstrap Project Make Command 1.Go into the board directory. 2. Select your board by going into the corresponding board directory. 3. Select your project by going into the corresponding project directory. 4. Configure your project (Makefile and header file). 5. Type make.

27 Adding a New Board to an AT91Bootstrap Project Copy the board directory which is the most similar to your board, e.g. cd board cp -r at91sam9261ek/ my_board/ Rename board-specific files. cd my_board mv at91sam9261ek.c my_board.c mv “project“/at91sam9261ek.h “project“/my_board.h Edit corresponding “project“ Makefile and modify BOARD variable accordingly. BOARD=my_board PROJECT=“project“ Make your modifications and compile the project.

28 Adding a New Project to a Board Copy the board directory which is the most similar to your board. cd board/my_board mkdir new_project Copy a Makefile and my_board.h header file. cp dataflash/* new_project/. Edit corresponding “new_project“ Makefile and modify PROJECT variable accordingly. PROJECT=new_project

29 Adding a New Driver to an AT91Bootstrap Project Add the new driver in the driver directory. Move the pieces of code which are product or board dependent into the board/your_board/ directory. If necessary, add an include file with the same driver name in the include directory. Use pre-processor instructions to insert your new feature into the AT91Bootstrap project. Add new driver file into project Makefile.


Download ppt "AT91Bootstrap. Introduction Device initialization such as clock speed configuration, PIO settings, etc. Peripheral drivers such as PIO, PMC, SDRAMC, etc."

Similar presentations


Ads by Google