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

modsrc = files(
fleur's avatar
fleur committed
4
  'modules/buttons.c',
Rahix's avatar
Rahix committed
5
6
  'modules/fat_file.c',
  'modules/fat_reader_import.c',
7
  'modules/gpio.c',
Gerd's avatar
Gerd committed
8
  'modules/interrupt.c',
fleur's avatar
fleur committed
9
  'modules/sys_leds.c',
Rahix's avatar
Rahix committed
10
  'modules/light_sensor.c',
11
  'modules/os.c',
12
  'modules/personal_state.c',
Gerd's avatar
Gerd committed
13
14
  'modules/sys_display.c',
  'modules/utime.c',
Gerd's avatar
Gerd committed
15
  'modules/vibra.c',
chris007's avatar
chris007 committed
16
  'modules/bme680.c'
Rahix's avatar
Rahix committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
)

#################################
# 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',
32
  input: [micropython_mod_sources, modsrc],
Rahix's avatar
Rahix committed
33
34
35
36
37
38
39
  command: [micropython_gen_modules, '@OUTPUT@', '@INPUT@'],
)

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

mp_headers = [version_h, modules_h, qstr_h]

51
52
53
54
55
56
57
58
59
60
61
62
63
64
#################################
#    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
65
66
67
68
69
70
71
72
###################
# MicroPython Lib #
###################

upy = static_library(
  'micropython',
  micropython_sources,
  micropython_additional_sources,
73
  micropython_extmod_sources,
Rahix's avatar
Rahix committed
74
75
76
77
  mp_headers,
  include_directories: micropython_includes,
)

78
elf = executable(
Rahix's avatar
Rahix committed
79
80
  name + '.elf',
  'main.c',
81
  'patch.c',
Rahix's avatar
Rahix committed
82
  'mphalport.c',
83
  frozen_source,
Rahix's avatar
Rahix committed
84
85
  modsrc,
  mp_headers,
Rahix's avatar
Rahix committed
86
  version_hdr,
Rahix's avatar
Rahix committed
87
  include_directories: micropython_includes,
88
  dependencies: [max32665_startup_core1, periphdriver, api_caller],
Rahix's avatar
Rahix committed
89
  link_with: upy,
90
  link_whole: [max32665_startup_core1_lib, api_caller_lib],
Rahix's avatar
Rahix committed
91
92
93
94
  link_args: [
    '-Wl,-Map=' + meson.current_build_dir() + '/' + name + '.map',
  ],
)
95

96
bin = custom_target(
97
98
99
  name + '.bin',
  build_by_default: true,
  output: name + '.bin',
100
  input: elf,
101
102
  command: [build_image, '@INPUT@', '@OUTPUT0@'],
)
103
104
105
106
107
108
109
110

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