Readme updates and use a subproject for the BSP
parent
02a2483831
commit
980700e68a
40
README.md
40
README.md
|
@ -5,7 +5,7 @@ reference design and a firmware module.
|
|||
|
||||
## Quick links
|
||||
|
||||
- [Reference hardware implementation, bipolar and up to 8 channels](doc/Ref-good.pdf)
|
||||
- [Reference hardware implementation, bipolar and up to 8 channels](doc/Ref-good/Ref-good.pdf)
|
||||
- [Reference hardware implementation, unipolar single-channel](doc/Ref-cheap.pdf)
|
||||
- [Theory of operation](doc/TOO.md)
|
||||
- [Why you should use it](#why-you-should-use-it)
|
||||
|
@ -79,32 +79,32 @@ directly as a subproject. The following options should be defined:
|
|||
and `none`. If you use `none`, TIMDAC can link against port functions you
|
||||
provide externally.
|
||||
|
||||
- `timdac_config` — set to the _contents_ of the config header,
|
||||
`timdac_config.h`. This admittedly unusual step is done to allow the use of
|
||||
a large, verbose configuration file that can be managed in the way most
|
||||
embedded projects handle compile-time configuration; Meson currently does not
|
||||
provide any better way to pass configuration like this into a subproject.
|
||||
See the example below:
|
||||
- `bsp` — set to the name of a subproject containing your board support
|
||||
pack. This is where the config header, `timdac_config.h`, should live.
|
||||
This is a nice, clean way to pull hardware definitions from the root project
|
||||
into subprojects in Meson. If you're not using this approach already, you
|
||||
can configure a very small board support pack like this:
|
||||
|
||||
```
|
||||
fs = import('fs')
|
||||
$ ls subprojects/bsp-foo
|
||||
meson.build
|
||||
timdac_config.h
|
||||
|
||||
libtimdac_proj = subproject(
|
||||
'timdac',
|
||||
default_options: [
|
||||
'timdac_hw=ch32v103',
|
||||
'timdac_config=' + fs.read('src/timdac_config.h'),
|
||||
],
|
||||
)
|
||||
$ cat subprojects/bsp-foo/meson.build
|
||||
project('bsp-timdac', 'c')
|
||||
|
||||
libtimdac_dep = libtimdac_proj.get_variable('libtimdac_dep')
|
||||
bsp_dep = declare_dependency(include_directories: include_directories('.'))
|
||||
```
|
||||
|
||||
If you want to call the dependency something other than `bsp_dep`, you can set
|
||||
the same-named option (`bsp_dep`) to its actual name.
|
||||
|
||||
A template configuration file can be found in
|
||||
`inc/timdac_config_template_ch32v103.h` (TODO: link this). All of the
|
||||
configuration options for TIMDAC itself are documented in `inc/timdac.h`, and
|
||||
the configuration options for each hardware driver are documented in that
|
||||
driver's source file (e.g. `src/timdac_hw_ch32v103.c`).
|
||||
[`timdac_config_template_ch32v103.h`](inc/timdac_config_template_ch32v103.h).
|
||||
All of the configuration options for TIMDAC itself are documented in
|
||||
[`timdac.h`](inc/timdac.h), and the configuration options for each hardware
|
||||
driver are documented in that driver's source file (e.g.
|
||||
[`timdac_hw_ch32v103.c`](src/timdac_hw_ch32v103.c)).
|
||||
|
||||
### Using TIMDAC
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
(kicad_pcb (version 20221018) (generator pcbnew)
|
||||
)
|
|
@ -0,0 +1,330 @@
|
|||
{
|
||||
"board": {
|
||||
"3dviewports": [],
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.1,
|
||||
"copper_line_width": 0.2,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"other_line_width": 0.15,
|
||||
"silk_line_width": 0.15,
|
||||
"silk_text_size_h": 1.0,
|
||||
"silk_text_size_v": 1.0,
|
||||
"silk_text_thickness": 0.15
|
||||
},
|
||||
"diff_pair_dimensions": [],
|
||||
"drc_exclusions": [],
|
||||
"rules": {
|
||||
"min_copper_edge_clearance": 0.0,
|
||||
"solder_mask_clearance": 0.0,
|
||||
"solder_mask_min_width": 0.0
|
||||
},
|
||||
"track_widths": [],
|
||||
"via_dimensions": []
|
||||
},
|
||||
"layer_presets": [],
|
||||
"viewports": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_label_syntax": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"missing_bidi_pin": "warning",
|
||||
"missing_input_pin": "warning",
|
||||
"missing_power_pin": "error",
|
||||
"missing_unit": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"simulation_model_issue": "error",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "ref1.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 3
|
||||
},
|
||||
"net_colors": null,
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": []
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "",
|
||||
"specctra_dsn": "",
|
||||
"step": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"dashed_lines_dash_length_ratio": 12.0,
|
||||
"dashed_lines_gap_length_ratio": 3.0,
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.375,
|
||||
"pin_symbol_size": 25.0,
|
||||
"text_offset_ratio": 0.15
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"spice_adjust_passive_values": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"spice_save_all_currents": false,
|
||||
"spice_save_all_voltages": false,
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"147c394d-2e75-4129-bc0f-30a4f3d72d20",
|
||||
""
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
17
meson.build
17
meson.build
|
@ -1,7 +1,8 @@
|
|||
project('timdac', 'c', default_options: ['default_library=static'])
|
||||
|
||||
o_hw = get_option('timdac_hw')
|
||||
o_config = get_option('timdac_config')
|
||||
o_bsp = get_option('bsp')
|
||||
o_bsp_dep = get_option('bsp_dep')
|
||||
|
||||
sources = ['src/timdac.c', 'src/timdac_ll.c']
|
||||
dependencies = []
|
||||
|
@ -14,19 +15,17 @@ if o_hw == 'ch32v103'
|
|||
sources += ['src/timdac_hw_ch32v103.c']
|
||||
endif
|
||||
|
||||
add_project_arguments(defs, language: ['c', 'cpp'])
|
||||
if o_bsp != ''
|
||||
bsp_proj = subproject(o_bsp)
|
||||
bsp_dep = bsp_proj.get_variable(o_bsp_dep)
|
||||
dependencies += bsp_dep
|
||||
endif
|
||||
|
||||
config_h = custom_target(
|
||||
'timdac_config.h',
|
||||
command: [find_program('echo'), o_config],
|
||||
capture: true,
|
||||
output: 'timdac_config.h',
|
||||
)
|
||||
add_project_arguments(defs, language: ['c', 'cpp'])
|
||||
|
||||
timdac_lib = library(
|
||||
'timdac',
|
||||
sources,
|
||||
config_h,
|
||||
dependencies: dependencies,
|
||||
include_directories: ['inc'],
|
||||
)
|
||||
|
|
|
@ -4,6 +4,11 @@ option(
|
|||
)
|
||||
|
||||
option(
|
||||
'timdac_config', type: 'string',
|
||||
description: 'Contents of timdac_config.h',
|
||||
'bsp', type: 'string', value: '',
|
||||
description: 'Name of subproject to use as a board support pack',
|
||||
)
|
||||
|
||||
option(
|
||||
'bsp_dep', type: 'string', value: 'bsp_dep',
|
||||
description: 'Name of the main dependency object in the board support pack',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue