@@ -385,3 +385,107 @@ The (incomplete) list of SYNTH_FLAGS array items
385
385
- USE_XPM_LIBRARIES: includes XPM_CDC XPM_MEMORY XPM_FIFO in Vivado projects
386
386
387
387
For other values and their purpose see the Vivado.inc.tcl or Quartus.inc.tcl file in the build directory.
388
+
389
+ Device Tree nodes
390
+ -----------------
391
+
392
+ For the software to find internal firmware components, a *Device Tree (DT) * is
393
+ used. This provides a tree of available parts (called nodes in the DT
394
+ terminology) of the design that can be accessed from the host without
395
+ restriction. A developer creates TCL procedures that generate nodes to *DT
396
+ string (DTS) * for the components he finds fit. Since the creation of the DTS can
397
+ be challenging, there are several TCL procedures provided that simplify the
398
+ process. These procedures are contained within the ``dts_templates.tcl `` file
399
+ with clarifying comments. The following examples provide an overview of their
400
+ usage.
401
+
402
+ Example 1
403
+ ~~~~~~~~~
404
+
405
+ This presents a least viable code that creates a node
406
+ ``dma_calypte_rx_perf_cntrs0 `` with the base address *0x8000 *
407
+ and the size *0x30 *. It also contains a compatible string
408
+ ``cesnet,dma_calypte_rx_perf_cntrs ``. The string property is appended to ``dts ``
409
+ variable that contains a reference to the required Device Tree string (DTS).
410
+
411
+ .. code-block :: tcl
412
+
413
+ dts_create_node dts "dma_calypte_rx_perf_cntrs0" {
414
+ dts_appendprop_comp_node dts 0x8000 0x30 "cesnet,dma_calypte_rx_perf_cntrs"
415
+ }
416
+
417
+ Example 2
418
+ ~~~~~~~~~
419
+
420
+ A second, more complex example demonstrates addition of multiple properties to a
421
+ node called ``dma_ctrl_calypte_$dir$id `` (string can be further adjusted through
422
+ parameters ``dir `` and ``id ``).
423
+
424
+ .. code-block :: tcl
425
+
426
+ proc dts_dma_calypte_ctrl {DTS dir id base pcie} {
427
+ upvar 1 $DTS dts
428
+
429
+ dts_create_node dts "dma_ctrl_calypte_$dir$id" {
430
+ # Adding compatible string "cesnet,dma_ctrl_calypte_$dir" and the
431
+ # reg property with base address $base and the size 0x80.
432
+ dts_appendprop_comp_node dts $base 0x80 "cesnet,dma_ctrl_calypte_$dir"
433
+ # Integer property called "version" with the value 0x10000
434
+ dts_appendprop_int dts "version" 0x10000
435
+ # Integer prperty "pcie" with the value of $pcie
436
+ dts_appendprop_int dts "pcie" $pcie
437
+
438
+ # The addition of custom properties (customly named) can be done
439
+ # through a standard "append" macro.
440
+ if { $dir == "tx" } {
441
+ append dts "data_buff = <&dma_calypte_tx_data_buff$id>;"
442
+ append dts "hdr_buff = <&dma_calypte_tx_hdr_buff$id>;"
443
+ }
444
+ append dts "params = <&dma_params_$dir$pcie>;"
445
+ }
446
+ }
447
+
448
+ Example 3
449
+ ~~~~~~~~~
450
+
451
+ This example shows how complex node with multiple subnodes is created. The parent
452
+ node is called ``dma_calypte_test_core0 `` and contains subnodes
453
+ ``mfb_loopback0 ``, ``dma_calypte_debug_core0 ``, ``dma_calypte_latency_meter0 ``
454
+ and ``dma_calypte_reset_fsm0 ``. Further nesting of nodes is possible as can be
455
+ seen when adding the ``mfb_generator0 `` node. Each of the called procedures
456
+ contain a reference to the same DTS from the ``dts `` variable.
457
+
458
+ .. code-block :: tcl
459
+
460
+ proc dts_calypte_test_core {DTS base_addr} {
461
+ # Populate reference from the calling environment
462
+ upvar 1 $DTS dts
463
+
464
+ set LOOPBACK_BASE_ADDR [expr $base_addr + 0x0]
465
+ set TX_DBG_CORE_BASE_ADDR [expr $base_addr + 0x10000]
466
+ set LATENCY_METER_BASE_ADDR [expr $base_addr + 0x20000]
467
+ set RESET_FSM_BASE_ADDR [expr $base_addr + 0x30000]
468
+
469
+ dts_create_node dts "dma_calypte_test_core0" {
470
+
471
+ dts_create_node dts "mfb_loopback0" {
472
+ dts_appendprop_comp_node dts $LOOPBACK_BASE_ADDR 8 "cesnet,mfb_loopback"
473
+ }
474
+
475
+ dts_create_node dts "dma_calypte_debug_core0" {
476
+ dts_appendprop_comp_node dts $TX_DBG_CORE_BASE_ADDR 0x1600 "cesnet,dma_calypte_debug_core"
477
+
478
+ dts_create_node dts "mfb_generator0" {
479
+ dts_appendprop_comp_node dts [expr $TX_DBG_CORE_BASE_ADDR+0x8000] 0x40 "cesnet,mfb_generator"
480
+ }
481
+ }
482
+
483
+ dts_create_node dts "dma_calypte_latency_meter0" {
484
+ dts_appendprop_comp_node dts $LATENCY_METER_BASE_ADDR 0x30 "cesnet,dma_calypte_latency_meter"
485
+ }
486
+
487
+ dts_create_node dts "dma_calypte_reset_fsm0" {
488
+ dts_appendprop_comp_node dts $RESET_FSM_BASE_ADDR 0x4 "cesnet,dma_calypte_reset_fsm"
489
+ }
490
+ }
491
+ }
0 commit comments