meson.build 1.89 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
name = 'epicardium'

Rahix's avatar
Rahix committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
##########################################################################
#
# API
#
##########################################################################

api = custom_target(
  'api_*.c',
  input: 'epicardium.h',
  output: ['api_caller.c', 'api_dispatcher.c'],
  command: [
    python3,
    meson.current_source_dir() + '/api/genapi.py',
    '-H', '@INPUT0@',
    '-c', '@OUTPUT0@', '-s', '@OUTPUT1@',
  ],
  depend_files: 'api/genapi.py',
)

api_caller_lib = static_library(
  'api-caller',
  'api/caller.c',
  api[0], # Caller
  dependencies: periphdriver,
)

api_caller = declare_dependency(
  include_directories: include_directories('.'),
  link_with: api_caller_lib,
  dependencies: periphdriver,
)

api_dispatcher_lib = static_library(
  'api-dispatcher',
  'api/dispatcher.c',
  api[1], # Dispatcher
  dependencies: periphdriver,
)

Rahix's avatar
Rahix committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
##########################################################################
#
# FreeRTOS
#
##########################################################################

freertos = static_library(
  'freertos',
  freertos_sources,
  dependencies: periphdriver,
  include_directories: [
    freertos_includes,
    include_directories('./'),
  ],
)

Rahix's avatar
Rahix committed
58
59
60
61
62
63
##########################################################################
#
# Epicardium executable
#
##########################################################################

Rahix's avatar
Rahix committed
64
65
66
elf = executable(
  name + '.elf',
  'main.c',
67
  'cdcacm.c',
Rahix's avatar
Rahix committed
68
  'serial.c',
69
  dependencies: [libcard10, max32665_startup_core0, maxusb],
Rahix's avatar
Rahix committed
70
  link_with: [api_dispatcher_lib, freertos],
Rahix's avatar
Rahix committed
71
  link_whole: [max32665_startup_core0_lib, board_card10_lib],
Rahix's avatar
Rahix committed
72
  include_directories: [freertos_includes],
Rahix's avatar
Rahix committed
73
74
75
76
77
  link_args: [
    '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
  ],
)

78
epicardium_bin = custom_target(
Rahix's avatar
Rahix committed
79
80
81
82
83
84
  name + '.bin',
  build_by_default: true,
  output: name + '.bin',
  input: elf,
  command: [build_image, '@INPUT@', '@OUTPUT0@'],
)