Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
EDI-Systems committed Feb 22, 2018
1 parent 73cfe37 commit 41b6a39
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 72 deletions.
126 changes: 60 additions & 66 deletions MProkaron/Benchmark/Platform/test_STM32F767IG_RVM.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
#include "RMP.h"

//#define RUN_IN_VM /* Run this test in RVM virtual machine? */
/******************************************************************************
Filename : test_STM32F767IG_RVM.h
Author : pry
Date : 22/07/2017
Licence : LGPL v3+; see COPYING for details.
Description : The testbench for STM32F767IG, running in the RVM.
******************************************************************************/

/* When running these tests, we assume that the counting timer is already enabled */
#define TEST_YIELD /* Make yield tests */
#define TEST_MAIL /* Do mailbox tests */
#define TEST_SEM /* Do semaphore tests */
#define TEST_MAIL_INT /* Do mailbox interrupt tests */
#define TEST_SEM_INT /* Do semaphore interrupt tests */
/* Includes ******************************************************************/
#include "RMP.h"
/* End Includes **************************************************************/

/* Defines *******************************************************************/
/* How to read counter */
#define COUNTER_READ() (TIM2->CNT)
#define COUNTER_READ() ((TIM2->CNT)<<1)
/* Are we doing minimal measurements? */
/* #define MINIMAL_SIZE */
/* The STM32F7 timers are all 32 bits, so */
typedef ptr_t tim_t;
/* End Defines ***************************************************************/

/* Globals *******************************************************************/
#ifndef MINIMAL_SIZE
void Int_Handler(void);
ptr_t Stack_1[256];
struct RMP_Thd Thd_1={0};
ptr_t Stack_2[256];
struct RMP_Thd Thd_2={0};
struct RMP_Sem Sem_1={0};

#ifdef RUN_IN_VM
/* Page table stuff */
const struct RVM_Hdr_Pgtbl RMP_Pgtbl[1]=
{
/* The first page table */
Expand Down Expand Up @@ -54,73 +70,51 @@ const struct RVM_Image RMP_Image=
RMP_Pgtbl /* const struct RVM_Hdr_Pgtbl* Pgtbl */,
0 /* const struct RVM_Image* const * const Next_Image; */
};
#endif

ptr_t Stack_1[256];
struct RMP_Thd Thd_1={0};
ptr_t Stack_2[256];
struct RMP_Thd Thd_2={0};
struct RMP_Sem Sem_1={0};
ptr_t Time;
//TIM_HandleTypeDef TIM2_Handle={0};
//TIM_HandleTypeDef TIM4_Handle={0};
/* End Globals ***************************************************************/

/* Begin Function:Timer_Init **************************************************
Description : Initialize the timer for timing measurements. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Timer_Init(void)
{
// /* Initialize timer 2 to run at the same speed as the CPU */
// TIM2_Handle.Instance=TIM2;
// TIM2_Handle.Init.Prescaler=0;
// TIM2_Handle.Init.CounterMode=TIM_COUNTERMODE_UP;
// TIM2_Handle.Init.Period=(unsigned int)(-1);
// TIM2_Handle.Init.ClockDivision=TIM_CLOCKDIVISION_DIV1;
// HAL_TIM_Base_Init(&TIM2_Handle);
// __HAL_RCC_TIM2_CLK_ENABLE();
// __HAL_TIM_ENABLE(&TIM2_Handle);
/* Timer is initialized on startup by the M7M1 kernel */
}
/* End Function:Timer_Init ***************************************************/

/* Begin Function:Int_Init ****************************************************
Description : Initialize an periodic interrupt source. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Int_Init(void)
{
// /* Initialize timer 2 to run at the same speed as the CPU */
// TIM4_Handle.Instance=TIM4;
// TIM4_Handle.Init.Prescaler=0;
// TIM4_Handle.Init.CounterMode=TIM_COUNTERMODE_UP;
// TIM4_Handle.Init.Period=10000;
// TIM4_Handle.Init.ClockDivision=TIM_CLOCKDIVISION_DIV1;
// TIM4_Handle.Init.RepetitionCounter=0;
// HAL_TIM_Base_Init(&TIM4_Handle);
// __HAL_RCC_TIM4_CLK_ENABLE();
// __HAL_TIM_ENABLE(&TIM4_Handle);
// /* Clear interrupt pending bit, because we used EGR to update the registers */
// __HAL_TIM_CLEAR_IT(&TIM4_Handle, TIM_IT_UPDATE);
// HAL_TIM_Base_Start_IT(&TIM4_Handle);
/* Interrupt generation is initialized too, here we only register our handler */
RMP_Vect[2]=(ptr_t)Int_Handler;
}
/* End Function:Int_Init *****************************************************/

/* Begin Function:Int_Disable *************************************************
Description : Disable the periodic interrupt source. This function needs
to be adapted to your specific hardware.
Input : None.
Output : None.
Return : None.
******************************************************************************/
void Int_Disable(void)
{
/* Disable timer 4 interrupt */
NVIC_DisableIRQ(TIM4_IRQn);
}

//void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim)
//{
// if(htim->Instance==TIM4)
// {
// /* Set the interrupt priority */
// NVIC_SetPriority(TIM4_IRQn,0xFF);
// /* Enable timer 4 interrupt */
// NVIC_EnableIRQ(TIM4_IRQn);
// /* Enable timer 4 clock */
// __HAL_RCC_TIM4_CLK_ENABLE();
// }
//}

void Int_Handler(void);

void TIM4_IRQHandler(void)
{
TIM4->SR=~TIM_FLAG_Update;//TIM_FLAG_UPDATE;
Int_Handler();
/* Reverse registration */
RMP_Vect[2]=0;
}
#endif
/* End Function:Int_Disable **************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/

2 changes: 1 addition & 1 deletion MProkaron/Benchmark/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: The configuration file for testing program.
******************************************************************************/

/* Config Includes ***********************************************************/
#include "Platform/test_STM32F405RG.h"
#include "Platform/test_STM32F767IG_RVM.h"
/* End Config Includes *******************************************************/

/* End Of File ***************************************************************/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
Filename : platform_cmx_RVM_conf.h
Filename : platform_cmx_conf.h
Author : pry
Date : 24/06/2017
Licence : LGPL v3+; see COPYING for details.
Expand Down
2 changes: 1 addition & 1 deletion MProkaron/Include/Platform/RMP_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description : The platform specific types for RMP.
******************************************************************************/

/* Platform Includes *********************************************************/
#include "Platform/CortexM/platform_cmx.h"
#include "Platform/CortexM_RVM/platform_cmx_RVM.h"
/* End Platform Includes *****************************************************/

/* End Of File ***************************************************************/
Expand Down
15 changes: 15 additions & 0 deletions Project/RVMDK-STM32F767IGT6-RVM/RMP_platform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/******************************************************************************
Filename : RMP_platform.h
Author : pry
Date : 22/07/2017
Licence : LGPL v3+; see COPYING for details.
Description : The platform specific types for RMP.
******************************************************************************/

/* Platform Includes *********************************************************/
#include "Platform/CortexM_RVM/platform_cmx_RVM.h"
/* End Platform Includes *****************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
6 changes: 3 additions & 3 deletions Project/RVMDK-STM32F767IGT6-RVM/RTOS-Mutate.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg1Name>copy.bat</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
Expand Down Expand Up @@ -334,7 +334,7 @@
<MiscControls></MiscControls>
<Define>STM32F767xx,USE_HAL_DRIVER</Define>
<Undefine></Undefine>
<IncludePath>..\..\MProkaron\Include;..\..\..\..\Library\STM32F7xx_HAL_Driver\Core;..\..\..\..\Library\STM32F7xx_HAL_Driver\Inc;..\..\..\..\Library\STM32F7xx_HAL_Driver\Inc\Conf</IncludePath>
<IncludePath>..\..\MProkaron\Include;..\..\..\M0P0_Library\STM32F7xx_HAL_Driver\Core;..\..\..\M0P0_Library\STM32F7xx_HAL_Driver\Inc;..\..\..\M0P0_Library\STM32F7xx_HAL_Driver\Inc\Conf</IncludePath>
</VariousControls>
</Cads>
<Aads>
Expand Down
3 changes: 3 additions & 0 deletions Project/RVMDK-STM32F767IGT6-RVM/copy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
copy platform_cmx_RVM_conf.h ..\..\MProkaron\Include\Platform\CortexM_RVM\platform_cmx_RVM_conf.h
copy RMP_platform.h ..\..\MProkaron\Include\Platform\RMP_platform.h
copy test.h ..\..\MProkaron\Benchmark\test.h
15 changes: 15 additions & 0 deletions Project/RVMDK-STM32F767IGT6-RVM/platform_cmx_RVM_conf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/******************************************************************************
Filename : platform_cmx_conf.h
Author : pry
Date : 24/06/2017
Licence : LGPL v3+; see COPYING for details.
Description: The configuration file for Cortex-M HAL.
******************************************************************************/

/* Config Includes ***********************************************************/
#include "Platform/CortexM_RVM/Chips/STM32F767IG/platform_STM32F767IG_RVM.h"
/* End Config Includes *******************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/
15 changes: 15 additions & 0 deletions Project/RVMDK-STM32F767IGT6-RVM/test.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/******************************************************************************
Filename : test.h
Author : pry
Date : 24/06/2017
Licence : LGPL v3+; see COPYING for details.
Description: The configuration file for testing program.
******************************************************************************/

/* Config Includes ***********************************************************/
#include "Platform/test_STM32F767IG_RVM.h"
/* End Config Includes *******************************************************/

/* End Of File ***************************************************************/

/* Copyright (C) Evo-Devo Instrum. All rights reserved ***********************/

0 comments on commit 41b6a39

Please sign in to comment.