Commit 8688fe9f authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Merge branch 'feature_buster' into 'master'

Feature buster

See merge request !59
parents a92497dc 2f902f85
function []=setOutputsBusSelector(in_type, in_busSel)
if(isa(in_type, 'Simulink.Bus'))
s='';
for i=1:length(in_type.Elements)
s=strcat(s,in_type.Elements(i).name);
if i < length(in_type.Elements)
s=strcat(s, ',');
end
end
set_param(in_busSel, 'OutputSignals', s);
end
DISABLED_TESTS=common/ shared-components/ logs/ DISABLED_TESTS=common/ shared-components/ logs/ __pycache__
export EXPECTED_FAILURES=test-stm32 air-iop1 stm32-serial-pohiada2 test-air-portnames stm32-f407-serial-pohi test-air-multiports test-air-interpartcomm stm32-f407-serial test-air-2cyclics stm32-f407-encodeReal TrafficLight_stm32f407_NonDistrib TrafficLight_stm32f407 msp430_cyclic_calls_protected msp430_cyclic_calls_sporadic msp430_cyclic_calls_unprotected msp430_protected_calls_protected msp430_protected_calls_sporadic msp430_protected_calls_unprotected msp430_sporadic_calls_protected msp430_sporadic_calls_sporadic msp430_sporadic_calls_unprotected msp430_unprotected_calls_protected msp430_unprotected_calls_sporadic msp430_unprotected_calls_unprotected msp430_ada msp430_cpp msp430_driver_e_usci_serial msp430_sdl_ada msp430_sdl_c export EXPECTED_FAILURES=test-stm32 air-iop1 stm32-serial-pohiada2 test-air-portnames stm32-f407-serial-pohi test-air-multiports test-air-interpartcomm stm32-f407-serial test-air-2cyclics stm32-f407-encodeReal TrafficLight_stm32f407_NonDistrib TrafficLight_stm32f407 msp430_cyclic_calls_protected msp430_cyclic_calls_sporadic msp430_cyclic_calls_unprotected msp430_protected_calls_protected msp430_protected_calls_sporadic msp430_protected_calls_unprotected msp430_sporadic_calls_protected msp430_sporadic_calls_sporadic msp430_sporadic_calls_unprotected msp430_unprotected_calls_protected msp430_unprotected_calls_sporadic msp430_unprotected_calls_unprotected msp430_ada msp430_cpp msp430_driver_e_usci_serial msp430_sdl_ada msp430_sdl_c Demo_CoRA_MBAD_4ZYNQ_GNC Demo_CoRA_MBAD_4ZYNQ_PrimeNumbers Demo_CoRA_MBAD_4ZYNQ_SWonly
TEST_CASES=$(sort $(filter-out $(DISABLED_TESTS), $(dir $(wildcard */)))) TEST_CASES=$(sort $(filter-out $(DISABLED_TESTS), $(dir $(wildcard */))))
export MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)" export MAKEFLAGS="-j $(grep -c ^processor /proc/cpuinfo)"
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
......
-------------------------------------------------------- --------------------------------------------------------
--! File generated by asn2aadl v2.2-rb072508: DO NOT EDIT ! --! File generated by asn2aadl v2.2-r90f76d6: DO NOT EDIT !
-------------------------------------------------------- --------------------------------------------------------
--! MadeInFastMode:True: --! MadeInFastMode:True:
--! InputASN1FileChecksum:ee8a7e01f29874c0d50f437d5abb9599:/home/taste/tool-inst/share/taste-types/taste-types.asn: --! InputASN1FileChecksum:ee8a7e01f29874c0d50f437d5abb9599:/home/taste/tool-inst/share/taste-types/taste-types.asn:
--! InputASN1FileChecksum:ab9d290c8d36e7745075bc55a61d8ddc:DataView.asn: --! InputASN1FileChecksum:ab9d290c8d36e7745075bc55a61d8ddc:DataView.asn:
--! InputASN1FileChecksum:ee46426c862c2136923e35b32818b60c:dataview-stm32.asn:
-------------------------------------------------------- --------------------------------------------------------
package DataView package DataView
...@@ -80,6 +81,45 @@ PROPERTIES ...@@ -80,6 +81,45 @@ PROPERTIES
Data_Model::Data_Representation => Struct; Data_Model::Data_Representation => Struct;
END Command_Buffer.impl; END Command_Buffer.impl;
DATA Debug_PrintableString
PROPERTIES
-- name of the ASN.1 source file:
Source_Text => ("dataview-stm32.asn");
TASTE::Ada_Package_Name => "STM32_Dataview";
Deployment::ASN1_Module_Name => "STM32-Dataview";
Source_Language => (ASN1);
-- name of the corresponding data type in the source file:
Type_Source_Name => "Debug-PrintableString";
TASTE::Position_In_File => [ line => 4 ; column => 1 ; ];
-- what kind of type is this?
TASTE::ASN1_Basic_Type =>aSTRING;
END Debug_PrintableString;
DATA IMPLEMENTATION Debug_PrintableString.impl
END Debug_PrintableString.impl;
DATA Debug_PrintableString_Buffer_Max
END Debug_PrintableString_Buffer_Max;
DATA IMPLEMENTATION Debug_PrintableString_Buffer_Max.impl
-- Buffer to hold a marshalled data of type Debug_PrintableString
PROPERTIES
Data_Model::Data_Representation => array;
Data_Model::Base_Type => (classifier (DataView::Stream_Element_Buffer));
END Debug_PrintableString_Buffer_Max.impl;
DATA Debug_PrintableString_Buffer
END Debug_PrintableString_Buffer;
DATA IMPLEMENTATION Debug_PrintableString_Buffer.impl
-- Buffer to hold a marshalled data of type Debug_PrintableString
SUBCOMPONENTS
Buffer : data Debug_PrintableString_Buffer_Max.impl;
Length : data Base_Types::Unsigned_32;
PROPERTIES
Data_Model::Data_Representation => Struct;
END Debug_PrintableString_Buffer.impl;
DATA P_Light DATA P_Light
PROPERTIES PROPERTIES
-- name of the ASN.1 source file: -- name of the ASN.1 source file:
...@@ -359,6 +399,7 @@ END Taste_DataView; ...@@ -359,6 +399,7 @@ END Taste_DataView;
SYSTEM IMPLEMENTATION Taste_DataView.others SYSTEM IMPLEMENTATION Taste_DataView.others
SUBCOMPONENTS SUBCOMPONENTS
Command : DATA Command.impl; Command : DATA Command.impl;
Debug_PrintableString : DATA Debug_PrintableString.impl;
P_Light : DATA P_Light.impl; P_Light : DATA P_Light.impl;
T_Boolean : DATA T_Boolean.impl; T_Boolean : DATA T_Boolean.impl;
T_Int32 : DATA T_Int32.impl; T_Int32 : DATA T_Int32.impl;
......
...@@ -15,6 +15,7 @@ work/glue_built: InterfaceView.aadl DeploymentView.aadl DataView.aadl Concurrenc ...@@ -15,6 +15,7 @@ work/glue_built: InterfaceView.aadl DeploymentView.aadl DataView.aadl Concurrenc
clean: clean:
rm -rf work rm -rf work
git checkout -- .
.PHONY: clean skeletons c .PHONY: clean skeletons c
#!/usr/bin/python
# -*- coding: utf-8 -*-
''' Edit this module at will to create custom widgets that can send TC or
receive TM - and do anything you like with the data.
(c) 2016-2019 European Space Agency
'''
__author__ = "Maxime Perrotin, Thanassis Tsiodras"
__license__ = "LGPL"
__url__ = "https://taste.tools"
import sys
import os
import importlib
import DV
try:
from PySide.QtCore import (QObject, Signal, Slot, Qt, QTimer)
import PySide.QtGui as QtGui
except ImportError:
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from asn1_value_editor import UserWidgetsCommon
# ** IMPORTANT **
# you must list here the classes you want to expose to the GUI:
__all__ = ['PedestrianButton', 'TrafficLight', 'Pedestrian']
class PedestrianButton(UserWidgetsCommon.TC):
''' Fill / mimick this class to create a custom TC widget '''
name = 'Nice Button' # name on the GUI combo button
instantiated = False
def __init__(self, asn1_typename, parent):
''' Initialise the widget '''
super(PedestrianButton, self).__init__(asn1_typename, parent)
if PedestrianButton.instantiated:
self.close()
return
self._asn1_typename = asn1_typename
self.widget = QtGui.QPushButton("Request passage")
self.widget.clicked.connect(self.clicked)
self.setWidget(self.widget)
# parent is the ASN.1 value editor
self.parent = parent
self.setWindowTitle(parent.messageName)
self.show()
PedestrianButton.instantiated = True
@staticmethod
def applicable():
''' Return True to activate this widget '''
return True
@staticmethod
def editorIsApplicable(editor):
''' Return true if this particular editor is compatible with this
widget'''
return editor.messageName == "Button"
def clicked(self):
''' Called when user clicks on the button '''
self.parent.sendTC()
class TrafficLight(UserWidgetsCommon.TM):
'''Save telemetries in the database'''
name = 'View Traffic Light' # name for the combo button in the GUI
def __init__(self, parent=None):
''' Initialise the widget '''
super(TrafficLight, self).__init__(parent)
self.widget = QtGui.QLabel()
self.colorMap = { DV.red: QtGui.QPixmap ("red.png"),
DV.orange: QtGui.QPixmap ("orange.png"),
DV.green: QtGui.QPixmap ("green.png") }
self.widget.setPixmap (self.colorMap[DV.red])
self.setWidget(self.widget)
self.setWindowTitle(parent.treeItem.text())
self.show()
@Slot()
def new_tm(self):
''' Slot called when a TM has been received in the editor '''
# Nothing to do, the update() function does nothing thread-related
# that would need to be done here
pass
def update(self, value):
''' Receive ASN.1 value '''
color = value.Get()
self.widget.setPixmap (self.colorMap[color])
@staticmethod
def applicable():
''' Return True to enable this widget '''
return True
@staticmethod
def editorIsApplicable(editor):
''' Return true if this particular editor is compatible with this
widget'''
return editor.messageName == "Color"
class Pedestrian(UserWidgetsCommon.TM):
'''Save telemetries in the database'''
name = 'View Traffic Light' # name for the combo button in the GUI
def __init__(self, parent=None):
''' Initialise the widget '''
super(Pedestrian, self).__init__(parent)
self.widget = QtGui.QLabel()
self.colorMap = { DV.wait: QtGui.QPixmap ("wait.png"),
DV.go: QtGui.QPixmap ("go.png")}
self.widget.setPixmap (self.colorMap[DV.wait])
self.setWidget(self.widget)
self.setWindowTitle(parent.treeItem.text())
self.show()
@Slot()
def new_tm(self):
''' Slot called when a TM has been received in the editor '''
# Nothing to do, the update() function does nothing thread-related
# that would need to be done here
pass
def update(self, value):
''' Receive ASN.1 value '''
status = value.Get()
self.widget.setPixmap (self.colorMap[status])
@staticmethod
def applicable():
''' Return True to enable this widget '''
return True
@staticmethod
def editorIsApplicable(editor):
''' Return true if this particular editor is compatible with this
widget'''
return editor.messageName == "Info_User"
if __name__ == '__main__':
print('This module can only be imported from the main TASTE guis')
sys.exit(-1)
/* CIF PROCESS (250, 150), (150, 75) */
process Controller;
state Green;
substructure
in (short);
out (Go_Orange);
/* CIF START (604, 136), (70, 35) */
START short ;
/* CIF NEXTSTATE (583, 191), (110, 35) */
NEXTSTATE Second_Delay;
/* CIF START (343, 131), (70, 35) */
START;
/* CIF NEXTSTATE (331, 186), (93, 35) */
NEXTSTATE First_Delay;
/* CIF state (583, 191), (110, 35) */
state Second_Delay;
/* CIF input (604, 246), (70, 35) */
input Clock;
/* CIF return (621, 301), (35, 35) */
return Go_Orange;
endstate;
/* CIF state (331, 186), (93, 35) */
state First_Delay;
/* CIF input (206, 241), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (155, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (185, 351), (111, 35) */
NEXTSTATE Second_Delay;
/* CIF input (361, 241), (123, 35) */
input Button (cmd);
/* CIF PROCEDURECALL (336, 296), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF NEXTSTATE (364, 346), (117, 35) */
NEXTSTATE Second_Delay;
endstate;
endsubstructure;
state Red;
substructure
out (Go_Green);
/* CIF START (59, 69), (59, 35) */
START;
/* CIF NEXTSTATE (15, 119), (147, 35) */
NEXTSTATE Everybody_Stopped;
/* CIF state (237, 112), (73, 35) */
state Walking;
/* CIF input (238, 167), (70, 35) */
input Clock;
/* CIF output (211, 222), (124, 35) */
output Info_User (Wait);
/* CIF PROCEDURECALL (234, 277), (79, 35) */
call Blue_Off;
/* CIF PROCEDURECALL (184, 327), (178, 35) */
call Set_Timer (2000, Clock);
/* CIF NEXTSTATE (210, 382), (127, 35) */
NEXTSTATE Walking_Is_Over;
endstate;
/* CIF state (430, 116), (127, 35) */
state Walking_Is_Over;
/* CIF input (373, 171), (70, 35) */
input Clock;
/* CIF return (391, 226), (35, 35) */
return Go_Green;
/* CIF input (477, 171), (123, 35) */
input Button (cmd);
/* CIF task (453, 226), (172, 35) */
task Walk_Requested := True;
/* CIF NEXTSTATE (504, 281), (70, 35) */
NEXTSTATE -;
endstate;
/* CIF state (15, 119), (147, 35) */
state Everybody_Stopped;
/* CIF input (53, 174), (70, 35) */
input Clock;
/* CIF output (32, 229), (112, 35) */
output Info_User (Go);
/* CIF PROCEDURECALL (50, 284), (75, 35) */
call Blue_On;
/* CIF PROCEDURECALL (3, 334), (171, 35) */
call Set_Timer (5000, Clock);
/* CIF task (0, 389), (177, 35) */
task Walk_Requested := False;
/* CIF NEXTSTATE (52, 439), (73, 35) */
NEXTSTATE Walking;
endstate;
endsubstructure;
/* CIF TEXT (939, 61), (282, 152) */
timer clock;
dcl dummy t_Boolean;
dcl Walk_Requested T_Boolean := False;
dcl Cmd Command;
dcl blue_led t_boolean := true;
/* CIF ENDTEXT */
/* CIF START (155, 40), (70, 33) */
START;
/* CIF NEXTSTATE (152, 93), (75, 35) */
NEXTSTATE Off;
/* CIF state (152, 93), (75, 35) */
state Off;
/* CIF input (117, 148), (134, 35) */
input Initialize (dummy);
/* CIF PROCEDURECALL (142, 203), (85, 35) */
call Kick_WD;
/* CIF PROCEDURECALL (96, 253), (178, 35) */
call Set_Timer (1000, Clock);
/* CIF output (138, 308), (92, 35) */
output Color (Red);
/* CIF PROCEDURECALL (149, 363), (71, 35) */
call Red_On;
/* CIF PROCEDURECALL (145, 418), (79, 35) */
call Blue_Off;
/* CIF output (122, 468), (124, 35) */
output Info_User (Wait);
/* CIF NEXTSTATE (154, 518), (61, 35) */
NEXTSTATE Red;
endstate;
/* CIF state (548, 49), (70, 35) */
state Red;
/* CIF connect (583, 104), (0, 35) */
connect Go_Green;
/* CIF PROCEDURECALL (494, 159), (178, 35) */
call Set_Timer (5000, Clock);
/* CIF output (529, 214), (106, 35) */
output Color (Green);
/* CIF PROCEDURECALL (540, 269), (85, 35) */
call Green_On;
/* CIF decision (520, 319), (124, 50) */
decision Walk_requested;
/* CIF ANSWER (469, 389), (70, 24) */
(True):
/* CIF NEXTSTATE (444, 433), (119, 35) */
NEXTSTATE Green via Short;
/* CIF ANSWER (638, 389), (68, 24) */
(False):
/* CIF NEXTSTATE (635, 433), (74, 35) */
NEXTSTATE Green;
enddecision;
endstate;
/* CIF state (773, 61), (70, 35) */
state Orange;
/* CIF input (773, 116), (70, 35) */
input Clock;
/* CIF PROCEDURECALL (719, 171), (178, 35) */
call Set_Timer (1000, Clock);
/* CIF output (761, 226), (92, 35) */
output Color (Red);
/* CIF PROCEDURECALL (772, 281), (71, 35) */
call Red_On;
/* CIF NEXTSTATE (773, 331), (70, 35) */
NEXTSTATE Red;
endstate;
/* CIF state (973, 314), (70, 35) */
state Green;
/* CIF connect (1008, 369), (0, 35) */
connect Go_Orange;
/* CIF PROCEDURECALL (907, 419), (201, 35) */
call Set_Timer (2000, Clock);
/* CIF output (950, 474), (114, 35) */
output Color (Orange);
/* CIF PROCEDURECALL (961, 529), (93, 35) */
call Orange_On;
/* CIF NEXTSTATE (973, 579), (70, 35) */
NEXTSTATE Orange;
endstate;
endprocess Controller;
\ No newline at end of file
-- User implementation of the STM32_Debug function
-- This file will never be overwritten once edited and modified
-- Only the interface of functions is regenerated (in the .ads file)
-- Notes : in RM0090 section 10-3-3 we can find the mapping table for the DMA
-- it says for example that DMA1 can be connected to the transmitter of USART2
-- (USART2_Tx) using Channel 4 / Stream 6. This is the only right config
-- Main mappings:
-- DMA1 : USART2_Tx / Channel 4 / Stream 6
-- DMA1 : USART2_Rx / Channel 5 / Stream 5
-- DMA2 : USART6_Tx / Channel 5 / Stream 6 or Stream 7
-- DMA2 : USART6_Rx / Chennel 5 / Stream 1 or Stream 2
--
-- Then the alternate functions map also to specific USARTs:
-- AF7 maps to USART 1..3
-- AF8 maps to USART 4..6
--
-- And in the Datasheet of STM32F405/7 we have the GPIO / AF mapping:
-- PC6 = USART6_Tx
-- PC7 = USART6_Rx
-- PA2 = USART2_Tx (AF7)
-- PA3 = USART2_Rx (AF7)
pragma Style_Checks (off);
with STM32.Board; use STM32.Board;
with STM32.GPIO; use STM32.GPIO;
with STM32.DMA; use STM32.DMA;
with STM32.Device; use STM32.Device;
with HAL; use HAL;
with STM32.USARTs; use STM32.USARTs;
with Ada.Interrupts; use Ada.Interrupts;
with Ada.Interrupts.Names; use Ada.Interrupts.Names;
-- with Types; use Types;
with System;
with Interfaces; use Interfaces;
package body STM32_Debug is
-- PA2/PA3 are the GPIOs corresponding to the ftdi of the discovery shield
-- they are used for taste GUI communication
-- use PC6/PC7 for the debug printf
-- Transceiver : USART renames USART_2;
-- Transceiver_AF : constant STM32.GPIO_Alternate_Function := GPIO_AF_USART2_7;
-- TX_Pin : constant GPIO_Point := PA2;
-- RX_Pin : constant GPIO_Point := PA3;
-- Controller : DMA_Controller renames DMA_1;
-- Tx_Channel : constant DMA_Channel_Selector := Channel_4;
-- Tx_Stream : constant DMA_Stream_Selector := Stream_6;
-- Rx_Channel : constant DMA_Channel_Selector := Channel_5;
-- Rx_Stream : constant DMA_Stream_Selector := Stream_5;
-- USART_IRQ : constant Interrupt_ID := USART2_Interrupt;
TX_Pin : constant GPIO_Point := PC6;
RX_Pin : constant GPIO_Point := PC7;
Controller : DMA_Controller renames DMA_2;
Tx_Channel : constant DMA_Channel_Selector := Channel_5;
Tx_Stream : constant DMA_Stream_Selector := Stream_7;
Rx_Channel : constant DMA_Channel_Selector := Channel_5;
Rx_Stream : constant DMA_Stream_Selector := Stream_1;
USART_IRQ : constant Interrupt_ID := USART6_Interrupt;
Transceiver : USART renames USART_6;
Transceiver_AF : constant STM32.GPIO_Alternate_Function := GPIO_AF_USART6_8;
-- One-message buffer for reception
Incoming_Msg : aliased asn1sccDebug_PrintableString :=
asn1sccDebug_PrintableString_Init;
Msg_Idx : Natural := 0;
Msg_Complete : Boolean := False;
procedure Initialize_Hardware;
procedure String_To_OctetString (str : String ;
res : in out asn1sccDebug_PrintableString);
procedure String_To_OctetString (str : String ;
res : in out asn1sccDebug_PrintableString)
is
idx : Natural := 1;
begin
res.Length := str'Length;
for char of str loop
exit when idx > res.Data'Length;
res.Data (idx) := Character'Pos (char);
idx := idx + 1;
end loop;
end String_To_OctetString;
protected Reception is
-- Interrupt business must be done in a protected object
pragma Interrupt_Priority;
procedure Handle_Reception with Inline;
procedure IRQ_Handler with Attach_Handler => USART_IRQ;
end Reception;
protected body Reception is
procedure Handle_Reception is
-- Receive one char.
Received_Char : constant Character :=
Character'Val (Current_Input (Transceiver));
-- Buf : aliased asn1sccDebug_PrintableString;
begin
if Received_Char /= ASCII.CR and Msg_Idx < Incoming_Msg.Data'Length
then
if Msg_Idx = 0 then
Incoming_Msg := asn1sccDebug_PrintableString_Init;
Msg_Complete := False;
end if;
-- Append character to buffer
Msg_Idx := Msg_Idx + 1;
Incoming_Msg.Data (Msg_Idx) := Character'Pos (Received_Char);
Incoming_Msg.Length := Incoming_Msg.Length + 1;
else
-- Reception complete
Msg_Idx := 0;
loop
exit when not Status (Transceiver, Read_Data_Register_Not_Empty);
end loop;
-- If we disable interrupts here, it allows to receive data only
-- when we want... at the risk of missing data.
-- Disable_Interrupts (Transceiver, Source => Received_Data_Not_Empty);
-- String_To_OctetString(str => "Received: " & Received_Char & ASCII.CR & ASCII.LF,
-- res => Buf);
-- String_To_OctetString(str => "Received: ", res => Buf);
-- Send_to_UART (Buf'Access);
-- Send_to_UART (Incoming_Msg'Access);
-- Incoming_Msg.Length := 0;
Msg_Complete := True;
end if;
end;
procedure IRQ_Handler is
begin
-- check for data arrival
if Status (Transceiver, Read_Data_Register_Not_Empty) and
Interrupt_Enabled (Transceiver, Received_Data_Not_Empty)
then
Handle_Reception;
Clear_Status (Transceiver, Read_Data_Register_Not_Empty);
end if;
end IRQ_Handler;
end Reception;