When/where does the bsp_fdt_blob array get populated?

Travis Wheatley travis.wheatley at fireflyspace.com
Wed Apr 27 15:03:31 UTC 2016


I am trying to get the hello example to run on a T2080RDB board. I am getting a fatal error early in bsp_start in the following conditional that sets up some clock values. 

— Begin included text —

/* Initialize some device driver parameters */
  #if defined(HAS_UBOOT)
    BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq
      / QORIQ_BUS_CLOCK_DIVIDER;
    bsp_clicks_per_usec = BSP_bus_frequency / 8000000;
    rtems_counter_initialize_converter(
      #ifdef __PPC_CPU_E6500__
        bsp_uboot_board_info.bi_intfreq
      #else
        BSP_bus_frequency / 8
      #endif
    );
  #elif defined(U_BOOT_USE_FDT)
    {
      const void *fdt = bsp_fdt_get();
      int node;
      int len;
      fdt32_t *val_fdt;

      node = fdt_node_offset_by_prop_value(fdt, -1, "device_type", "cpu", 4);

      val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "bus-frequency", &len);
      if (val_fdt == NULL || len != 4) {
        bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
      }
      BSP_bus_frequency = fdt32_to_cpu(*val_fdt) / QORIQ_BUS_CLOCK_DIVIDER;

      val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "timebase-frequency", &len);
      if (val_fdt == NULL || len != 4) {
        bsp_fatal(QORIQ_FATAL_FDT_NO_BUS_FREQUENCY);
      }
      bsp_clicks_per_usec = fdt32_to_cpu(*val_fdt) / 1000000;

      #ifdef __PPC_CPU_E6500__
        val_fdt = (fdt32_t *) fdt_getprop(fdt, node, "clock-frequency", &len);
        if (val_fdt == NULL || len != 4) {
          bsp_fatal(QORIQ_FATAL_FDT_NO_CLOCK_FREQUENCY);
        }
      #endif
      rtems_counter_initialize_converter(fdt32_to_cpu(*val_fdt));
    }
  #endif

— End included text —

The code is taking the U_BOOT_USE_FDT path which in turn calls bsp_fdt_get which simply returns a pointer to the bsp_fdt_blob array. However, this array has never been initialized. So, I am left with the question: When/where is this fdt blob supposed to be initialized and where does it get its values from?

Also, I can’t help but wonder if I should be taking the HAS_UBOOT branch in the conditional, and if so where I define that. The procedure I am using to execute the example code is I first boot to a U-Boot prompt and then download the hello.bin file to its entry point (0x4000), attach with the CodeWarrior debugger through a JTAG TAP, and then execute the code by typing “go 0x4000” at the u-boot prompt. 

— Travis Wheatley




More information about the users mailing list