meson.build 2.54 KB
Newer Older
Rahix's avatar
Rahix committed
1
2
3
name = 'pycardium'

modsrc = files(
4
  'modules/bhi160-sys.c',
fleur's avatar
fleur committed
5
  'modules/buttons.c',
Rahix's avatar
Rahix committed
6
7
  'modules/fat_file.c',
  'modules/fat_reader_import.c',
8
  'modules/gpio.c',
Gerd's avatar
Gerd committed
9
  'modules/interrupt.c',
Rahix's avatar
Rahix committed
10
  'modules/light_sensor.c',
schneider's avatar
schneider committed
11
  'modules/max30001-sys.c',
12
  'modules/os.c',
13
  'modules/personal_state.c',
Stefan Haun's avatar
Stefan Haun committed
14
  'modules/power.c',
Rahix's avatar
Rahix committed
15
  'modules/sys_bme680.c',
Gerd's avatar
Gerd committed
16
  'modules/sys_display.c',
Rahix's avatar
Rahix committed
17
  'modules/sys_leds.c',
Gerd's avatar
Gerd committed
18
  'modules/utime.c',
Gerd's avatar
Gerd committed
19
  'modules/vibra.c',
20
  'modules/ws2812.c'
Rahix's avatar
Rahix committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
)

#################################
# MicroPython Generated Headers #
#################################

version_h = custom_target(
  'mpversion.h',
  output: 'mpversion.h',
  command: [micropython_gen_version, '@OUTPUT@'],
)

modules_h = custom_target(
  'moduledefs.h',
  output: 'moduledefs.h',
36
  input: [micropython_mod_sources, modsrc],
Rahix's avatar
Rahix committed
37
38
39
40
41
42
43
  command: [micropython_gen_modules, '@OUTPUT@', '@INPUT@'],
)

qstr_h = custom_target(
  'qstrdefs.generated.h',
  output: 'qstrdefs.generated.h',
  input: [
Rahix's avatar
Rahix committed
44
    'modules/qstrdefs.h',
Rahix's avatar
Rahix committed
45
    'mpconfigport.h',
46
    modules_h,
Rahix's avatar
Rahix committed
47
    micropython_sources,
48
    micropython_extmod_sources,
Rahix's avatar
Rahix committed
49
  ],
50
  depends: [version_h],
Rahix's avatar
Rahix committed
51
52
53
  command: [micropython_gen_qstr, meson.current_source_dir(), '@OUTPUT@', '@INPUT@'],
)

54
55
56
subdir('./genhdr')

mp_headers = [version_h, modules_h, qstr_h, qstr_genhdr_h]
Rahix's avatar
Rahix committed
57

58
59
60
61
62
63
64
65
66
67
68
69
70
71
#################################
#    Python Frozen Modules      #
#################################

subdir('modules/py')

frozen_source = custom_target(
  'frozen.c',
  output: 'frozen.c',
  input: [qstr_h, frozen_modules],
  build_by_default: true,
  command: [micropython_gen_frozen, '@OUTPUT@', '@INPUT@'],
)

Rahix's avatar
Rahix committed
72
73
74
75
76
77
78
79
###################
# MicroPython Lib #
###################

upy = static_library(
  'micropython',
  micropython_sources,
  micropython_additional_sources,
80
  micropython_extmod_sources,
Rahix's avatar
Rahix committed
81
82
83
84
  mp_headers,
  include_directories: micropython_includes,
)

85
elf = executable(
Rahix's avatar
Rahix committed
86
87
  name + '.elf',
  'main.c',
88
  'patch.c',
Rahix's avatar
Rahix committed
89
  'mphalport.c',
90
  frozen_source,
Rahix's avatar
Rahix committed
91
92
  modsrc,
  mp_headers,
Rahix's avatar
Rahix committed
93
  version_hdr,
Rahix's avatar
Rahix committed
94
  include_directories: micropython_includes,
95
  dependencies: [max32665_startup_core1, periphdriver, api_caller],
Rahix's avatar
Rahix committed
96
  link_with: upy,
97
  link_whole: [max32665_startup_core1_lib, api_caller_lib],
Rahix's avatar
Rahix committed
98
99
100
101
  link_args: [
    '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
  ],
)
102

103
bin = custom_target(
104
105
106
  name + '.bin',
  build_by_default: true,
  output: name + '.bin',
107
  input: elf,
108
109
  command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
110
111
112
113
114
115
116
117

custom_target(
  name + '_epicardium.bin',
  build_by_default: true,
  output: name + '_epicardium.bin',
  input: [epicardium_bin, bin],
  command: [build_multi_image, '@INPUT@', '@OUTPUT0@'],
)