2020-05-25 13:30:50 +02:00
|
|
|
#! /usr/bin/env python3
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
import os
|
|
|
|
|
import os.path
|
|
|
|
|
import subprocess
|
|
|
|
|
import sys
|
2018-07-11 19:07:41 +02:00
|
|
|
import distutils.spawn
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
|
|
2018-04-24 18:32:46 +02:00
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
def run_program(*argv):
|
2020-05-25 13:30:50 +02:00
|
|
|
print("$ %s" % " ".join(argv))
|
2018-04-24 18:32:46 +02:00
|
|
|
p = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
stdout, stderr = p.communicate()
|
|
|
|
|
|
|
|
|
|
return (p.returncode, stdout, stderr)
|
|
|
|
|
|
|
|
|
|
|
2018-04-24 18:32:46 +02:00
|
|
|
def gprbuild(project_file, debug=False):
|
2017-02-20 16:33:41 +01:00
|
|
|
extra_args = []
|
|
|
|
|
|
2018-09-03 17:29:29 +02:00
|
|
|
extra_args += ["-XADL_BUILD=" + ("Debug" if debug else "Production")]
|
|
|
|
|
extra_args += ["-XADL_BUILD_CHECKS=Enabled"]
|
2017-02-20 16:33:41 +01:00
|
|
|
|
2020-05-25 13:30:50 +02:00
|
|
|
print("Building '%s'" % project_file)
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
# Build the project
|
|
|
|
|
returncode, stdout, stderr = run_program(
|
2017-04-23 16:39:23 +02:00
|
|
|
'gprbuild', '-j0', '-p', '-q', '-s', '-P', project_file, *extra_args
|
2017-02-20 16:33:41 +01:00
|
|
|
)
|
|
|
|
|
|
2020-05-25 13:30:50 +02:00
|
|
|
print(stdout)
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
if returncode:
|
2020-05-25 13:30:50 +02:00
|
|
|
print('Build error (gprbuild returned {}):\n{}'.format(
|
2017-02-20 16:33:41 +01:00
|
|
|
returncode, stderr
|
2020-05-25 13:30:50 +02:00
|
|
|
))
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
# Clean to avoid error in the next build with a different run-time or
|
|
|
|
|
# compile switches.
|
2018-04-24 18:32:46 +02:00
|
|
|
run_program('gprclean', "-P", project_file, *extra_args)
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
return returncode
|
|
|
|
|
|
2018-04-24 18:32:46 +02:00
|
|
|
STM_DRIVERS = "/arch/ARM/STM32/driver_demos/"
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
# List of project to compile
|
2017-05-16 12:18:37 +02:00
|
|
|
projects = [
|
|
|
|
|
# STM32F429 Discovery
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/stm32f429_discovery/stm32f429_discovery_full.gpr",
|
|
|
|
|
"/boards/stm32f429_discovery/stm32f429_discovery_sfp.gpr",
|
|
|
|
|
"/examples/STM32F429_Discovery/draw_stm32f429disco.gpr",
|
|
|
|
|
"/examples/STM32F429_Discovery/blinky_f429disco.gpr",
|
|
|
|
|
"/examples/STM32F429_Discovery/dma2d_stm32f429disco.gpr",
|
|
|
|
|
"/examples/STM32F429_Discovery/serial_ports_f429disco.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# STM32F4 DISCO
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/stm32f407_discovery/stm32f407_discovery_full.gpr",
|
|
|
|
|
"/boards/stm32f407_discovery/stm32f407_discovery_sfp.gpr",
|
|
|
|
|
"/examples/STM32F4_DISCO/accelerometer/accelerometer.gpr",
|
|
|
|
|
"/examples/STM32F4_DISCO/simple_audio/simple_audio.gpr",
|
|
|
|
|
"/examples/STM32F4_DISCO/filesystem/filesystem.gpr",
|
|
|
|
|
"/examples/STM32F4_DISCO/blinky_f4disco.gpr",
|
|
|
|
|
"/examples/STM32F4_DISCO/serial_ports_f4disco.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
2023-10-30 14:56:02 +02:00
|
|
|
# STM32 F4VE
|
|
|
|
|
"/boards/stm32_f4ve/stm32_f4ve_full.gpr",
|
|
|
|
|
"/boards/stm32_f4ve/stm32_f4ve_sfp.gpr",
|
|
|
|
|
"/examples/stm32_f4ve/blinky_stm32_f4ve.gpr",
|
2023-11-24 14:24:30 +02:00
|
|
|
"/examples/stm32_f4ve/draw/draw.gpr",
|
2023-10-30 14:56:02 +02:00
|
|
|
"/examples/stm32_f4ve/lcd/lcd.gpr",
|
2024-06-23 13:37:19 +03:00
|
|
|
"/examples/stm32_f4ve/lcd_spi/lcd_spi.gpr",
|
2023-10-30 14:56:02 +02:00
|
|
|
|
2023-10-05 16:26:26 +03:00
|
|
|
# STM32F4XX M
|
|
|
|
|
"/boards/stm32f4xx_m/stm32f4xx_m_full.gpr",
|
|
|
|
|
"/boards/stm32f4xx_m/stm32f4xx_m_sfp.gpr",
|
|
|
|
|
"/examples/stm32f4xx_m/blinky/blinky.gpr",
|
2023-10-12 13:28:13 +03:00
|
|
|
"/examples/stm32f4xx_m/flash/flash.gpr",
|
2023-11-02 20:25:06 +02:00
|
|
|
"/examples/stm32f4xx_m/sdcard_fs/sdcard_fs.gpr",
|
|
|
|
|
"/examples/stm32f4xx_m/sdcard_raw_io/sdcard_raw_io.gpr",
|
2023-10-05 16:26:26 +03:00
|
|
|
|
2019-11-16 01:49:38 +01:00
|
|
|
# Feather STM32F405
|
|
|
|
|
"/examples/feather_stm32f405/blinky/blinky.gpr",
|
2019-11-16 00:24:30 +01:00
|
|
|
"/examples/feather_stm32f405/charlie_wing/charlie_wing.gpr",
|
2019-11-16 01:49:38 +01:00
|
|
|
|
2020-07-30 03:31:31 -07:00
|
|
|
# Olimex STM32-H405
|
|
|
|
|
"/examples/stm32_h405/blinky/blinky.gpr",
|
2020-09-17 05:49:10 -07:00
|
|
|
"/examples/stm32_h405/lcd_test/lcd_test.gpr",
|
2020-07-30 03:31:31 -07:00
|
|
|
|
2017-05-16 12:18:37 +02:00
|
|
|
# STM32F469 Discovery
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/stm32f469_discovery/stm32f469_discovery_full.gpr",
|
|
|
|
|
"/boards/stm32f469_discovery/stm32f469_discovery_sfp.gpr",
|
|
|
|
|
"/examples/STM32F469_Discovery/dma2d_stm32f469disco.gpr",
|
|
|
|
|
"/examples/STM32F469_Discovery/draw_stm32f469disco.gpr",
|
|
|
|
|
"/examples/STM32F469_Discovery/hello_world_tasking_f469disco.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
# STM32F746 Discovery
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/stm32f746_discovery/stm32f746_discovery_full.gpr",
|
|
|
|
|
"/boards/stm32f746_discovery/stm32f746_discovery_sfp.gpr",
|
|
|
|
|
"/examples/STM32F746_Discovery/dma2d_stm32f746disco.gpr",
|
|
|
|
|
"/examples/STM32F746_Discovery/draw_stm32f746disco.gpr",
|
|
|
|
|
"/examples/STM32F746_Discovery/blinky_f7disco.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
|
|
|
|
# STM32F769 Discovery
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/stm32f769_discovery/stm32f769_discovery_full.gpr",
|
|
|
|
|
"/boards/stm32f769_discovery/stm32f769_discovery_sfp.gpr",
|
|
|
|
|
"/examples/STM32F769_Discovery/dma2d_stm32f769disco.gpr",
|
|
|
|
|
"/examples/STM32F769_Discovery/draw_stm32f769disco.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
2019-02-04 16:53:05 +01:00
|
|
|
# NUCLEO-F446ZE
|
|
|
|
|
"/boards/nucleo_f446ze/nucleo_f446ze_full.gpr",
|
|
|
|
|
"/boards/nucleo_f446ze/nucleo_f446ze_sfp.gpr",
|
|
|
|
|
"/examples/nucleo_f446ze/blinky_f446ze.gpr",
|
|
|
|
|
|
2017-05-16 12:18:37 +02:00
|
|
|
# OpenMV2
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/OpenMV2/openmv2_full.gpr",
|
|
|
|
|
"/boards/OpenMV2/openmv2_sfp.gpr",
|
|
|
|
|
"/examples/OpenMV2/openmv2_example.gpr",
|
|
|
|
|
"/examples/OpenMV2/openmv2_example.gpr",
|
|
|
|
|
"/examples/OpenMV2/openmv2_example.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
|
|
|
|
# MicroBit
|
2018-04-24 18:32:46 +02:00
|
|
|
"/boards/MicroBit/microbit_zfp.gpr",
|
2018-07-06 12:56:19 +02:00
|
|
|
"/examples/MicroBit/text_scrolling/text_scrolling.gpr",
|
2018-07-13 19:51:43 +02:00
|
|
|
"/examples/MicroBit/buttons/buttons.gpr",
|
2018-06-21 19:27:33 +02:00
|
|
|
"/examples/MicroBit/digital_in/digital_in.gpr",
|
|
|
|
|
"/examples/MicroBit/music/music.gpr",
|
|
|
|
|
"/examples/MicroBit/analog_in/analog_in.gpr",
|
|
|
|
|
"/examples/MicroBit/analog_out/analog_out.gpr",
|
|
|
|
|
"/examples/MicroBit/digital_out/digital_out.gpr",
|
2018-07-06 12:56:19 +02:00
|
|
|
"/examples/MicroBit/BLE_beacon/BLE_beacon.gpr",
|
2019-07-22 12:26:47 +02:00
|
|
|
"/examples/MicroBit/servos/servos.gpr",
|
|
|
|
|
"/examples/MicroBit/neopixel/neopixel.gpr",
|
|
|
|
|
"/examples/MicroBit/follower/follower.gpr",
|
2019-11-04 16:41:48 +01:00
|
|
|
"/examples/MicroBit/accelerometer/accelerometer.gpr",
|
2017-05-16 12:18:37 +02:00
|
|
|
|
2020-02-13 16:21:11 +01:00
|
|
|
# NRF52_SDK
|
|
|
|
|
"/boards/NRF52_DK/nrf52_dk_zfp.gpr",
|
|
|
|
|
"/examples/NRF52_DK/buttons/buttons.gpr",
|
|
|
|
|
"/examples/NRF52_DK/BLE_beacon/BLE_beacon.gpr",
|
|
|
|
|
"/examples/NRF52_DK/digital_out/digital_out.gpr",
|
|
|
|
|
|
2017-05-16 12:18:37 +02:00
|
|
|
# STM32 driver examples
|
2018-04-24 18:32:46 +02:00
|
|
|
STM_DRIVERS + "/demo_adc_dma/demo_adc_dma.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_adc_interrupts/demo_adc_interrupts.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_adc_polling/demo_adc_polling.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_adc_timer_dma/demo_adc_timer_dma.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_adc_timer_triggered/demo_adc_timer_triggered.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_crc/demo_crc.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_dac_basic/demo_dac_basic.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_dac_dma/demo_dac_dma.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_dma_mem_to_mem/demo_dma_mem_to_mem.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_dma_mem_to_peripheral/demo_usart_dma_continuous.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_gpio_direct_leds/demo_gpio.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_independent_watchdog/demo_iwdg.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_L3GD20_dataready_int/demo_l3gd20_dataready_int.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_L3GD20_fifo_int/demo_l3gd20_fifo_int.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_L3GD20_polling/demo_l3gd20.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_LIS3DSH_pwm/demo_lis3dsh_pwm.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_LIS3DSH_tilt/demo_lis3dsh_tilt.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_rng/demo_rng.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_timer_interrupts_basic/demo_basic_timer_interrupts.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_timer_interrupts_multichannel/demo_timer_interrupts_multichannel.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_timer_pwm/demo_timer_pwm.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_timer_quad_encoder/demo_timer_quad_encoder.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_usart_interrupts/demo_usart_interrupts.gpr",
|
|
|
|
|
STM_DRIVERS + "/demo_usart_polling/demo_usart_polling.gpr",
|
2017-02-20 16:33:41 +01:00
|
|
|
]
|
|
|
|
|
|
2018-07-11 19:07:41 +02:00
|
|
|
# Check if RISC-V32 compiler is available
|
2025-05-13 15:46:37 +02:00
|
|
|
if distutils.spawn.find_executable("riscv64-elf-gnatls"):
|
2018-07-11 19:07:41 +02:00
|
|
|
|
|
|
|
|
# Add RISC-V32 projects
|
|
|
|
|
projects += ["/examples/HiFive1/hifive1_example.gpr"]
|
|
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
parser = argparse.ArgumentParser('Compile all the Ada_Drivers_Library examples')
|
|
|
|
|
|
2018-09-04 19:24:03 +02:00
|
|
|
parser.add_argument(
|
|
|
|
|
'--prod-only', action='store_true',
|
|
|
|
|
help='Only compile in production mode'
|
|
|
|
|
)
|
|
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
parser.add_argument(
|
|
|
|
|
'pattern', nargs='*',
|
|
|
|
|
help='List of patterns to filter the set of examples to build'
|
|
|
|
|
)
|
|
|
|
|
|
2018-04-24 18:32:46 +02:00
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
def main(args):
|
|
|
|
|
# Check if we can actually detect a build failure
|
2018-04-24 18:32:46 +02:00
|
|
|
ret = gprbuild("This_Project_Doesnt_Exist", debug=False)
|
2017-02-20 16:33:41 +01:00
|
|
|
if not ret:
|
2020-05-25 13:30:50 +02:00
|
|
|
print("Build failure is not detected")
|
2017-02-20 16:33:41 +01:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
ret = 0
|
2018-04-24 18:32:46 +02:00
|
|
|
for prj in projects:
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
# Check filter pattern, if any
|
|
|
|
|
if args.pattern and not any(pat in prj for pat in args.pattern):
|
|
|
|
|
continue
|
|
|
|
|
|
2018-09-04 19:24:03 +02:00
|
|
|
if not args.prod_only:
|
|
|
|
|
ret = ret or gprbuild(ROOT_DIR + prj, debug=True)
|
2018-04-24 18:32:46 +02:00
|
|
|
ret = ret or gprbuild(ROOT_DIR + prj, debug=False)
|
2017-02-20 16:33:41 +01:00
|
|
|
|
|
|
|
|
if ret:
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
2018-04-24 18:32:46 +02:00
|
|
|
|
2017-02-20 16:33:41 +01:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main(parser.parse_args())
|