Initial commit

This commit is contained in:
OneOfEleven
2023-09-09 08:03:56 +01:00
parent 92305117f1
commit 54441e27d9
3388 changed files with 582553 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
The MsgQueue project is a simple RTX Kernel based example
for a simulated Cortex-M3 device
Example functionality:
- Clock Settings:
- XTAL = 12 MHz
- Core = 12 MHz
The simple RTX Kernel based example shows how to use a
message queue to send data from one thread to another.
The message receiver thread prints the message contents
to the debug output window.
The MsgQueue example program is available for one target:
Simulation: configured for a simulated on-chip Flash

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<crun>
<version>1</version>
<filter_entries>
<filter index="0" type="default">
<type>*</type>
<start_file>*</start_file>
<end_file>*</end_file>
<action_debugger>0</action_debugger>
<action_log>1</action_log>
</filter>
</filter_entries>
</crun>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<settings>
<Stack>
<FillEnabled>0</FillEnabled>
<OverflowWarningsEnabled>1</OverflowWarningsEnabled>
<WarningThreshold>90</WarningThreshold>
<SpWarningsEnabled>1</SpWarningsEnabled>
<WarnLogOnly>1</WarnLogOnly>
<UseTrigger>1</UseTrigger>
<TriggerName>main</TriggerName>
<LimitSize>0</LimitSize>
<ByteLimit>50</ByteLimit>
</Stack>
<Trace1>
<Enabled>0</Enabled>
<ShowSource>1</ShowSource>
</Trace1>
<DebugChecksum>
<Checksum>2135918346</Checksum>
</DebugChecksum>
<Disassembly>
<InstrCount>0</InstrCount>
<MixedMode>1</MixedMode>
</Disassembly>
<CodeCoverage>
<Enabled>0</Enabled>
<ShowSource>0</ShowSource>
<HideCovered>0</HideCovered>
</CodeCoverage>
<Exceptions>
<StopOnUncaught>_ 0</StopOnUncaught>
<StopOnThrow>_ 0</StopOnThrow>
</Exceptions>
<CallStack>
<ShowArgs>0</ShowArgs>
</CallStack>
<DriverProfiling>
<Enabled>0</Enabled>
<Mode>1</Mode>
<Graph>0</Graph>
<Symbiont>0</Symbiont>
</DriverProfiling>
<CallStackLog>
<Enabled>0</Enabled>
</CallStackLog>
<CallStackStripe>
<ShowTiming>1</ShowTiming>
</CallStackStripe>
<TermIOLog>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
</TermIOLog>
<LogFile>
<LoggingEnabled>_ 0</LoggingEnabled>
<LogFile>_ ""</LogFile>
<Category>_ 0</Category>
</LogFile>
<InterruptLog>
<LogEnabled>0</LogEnabled>
<GraphEnabled>0</GraphEnabled>
<ShowTimeLog>1</ShowTimeLog>
<SumEnabled>0</SumEnabled>
<ShowTimeSum>1</ShowTimeSum>
<SumSortOrder>0</SumSortOrder>
</InterruptLog>
<DataLog>
<LogEnabled>0</LogEnabled>
<GraphEnabled>0</GraphEnabled>
<ShowTimeLog>1</ShowTimeLog>
<SumEnabled>0</SumEnabled>
<ShowTimeSum>1</ShowTimeSum>
</DataLog>
<DisassembleMode>
<mode>0</mode>
</DisassembleMode>
<Breakpoints2>
<Count>0</Count>
</Breakpoints2>
<Interrupts>
<Enabled>1</Enabled>
<Irq0>_ 0 400000 0 10000 0 0 100 100 0 1 "SysTick 1 0x3C"</Irq0>
<Count>1</Count>
</Interrupts>
<MemConfig>
<Base>1</Base>
<Manual>0</Manual>
<Ddf>1</Ddf>
<TypeViol>0</TypeViol>
<Stop>1</Stop>
</MemConfig>
<Aliases>
<Count>0</Count>
<SuppressDialog>0</SuppressDialog>
</Aliases>
<Simulator>
<Freq>10000000</Freq>
<FreqHi>0</FreqHi>
<MultiCoreRunAll>1</MultiCoreRunAll>
</Simulator>
</settings>

View File

@@ -0,0 +1,120 @@
/* --------------------------------------------------------------------------
* Copyright (c) 2013-2019 ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Name: main.c
* Purpose: RTX example program
*
*---------------------------------------------------------------------------*/
#include <stdio.h>
#include "RTE_Components.h"
#include CMSIS_device_header
#include "cmsis_os2.h"
void app_main (void *argument);
void app_msg (void *argument);
typedef struct msg_s {
uint8_t cmd;
uint8_t len;
uint8_t data[8];
} msg_t;
static osMessageQueueId_t msgQueue;
static const osThreadAttr_t msgAttr = {
.stack_size = 400U
};
/*----------------------------------------------------------------------------
* Application main thread
*---------------------------------------------------------------------------*/
void app_main (void *argument) {
(void)argument;
osStatus_t status;
uint32_t cnt = 0UL;
msg_t msg = {
.cmd = 1U,
.len = 4U,
.data = { 0U }
};
while (1) {
// Produce a new message and put it to the queue
++cnt;
*((uint32_t*)msg.data) = cnt;
status = osMessageQueuePut(msgQueue, &msg, 0U, osWaitForever);
if (status != osOK) {
printf("app_main: osMessageQueuePut failed.\n");
}
// Defer message creation
osDelay(osMessageQueueGetCount(msgQueue)*100U);
}
}
/*----------------------------------------------------------------------------
* Application message receiver thread
*---------------------------------------------------------------------------*/
void app_msg (void *argument) {
(void)argument;
osStatus_t status;
uint32_t cnt;
msg_t msg;
while (1) {
// Defer message processing
osDelay(osMessageQueueGetSpace(msgQueue)*100U);
// Wait forever until a message could be received
status = osMessageQueueGet(msgQueue, &msg, NULL, osWaitForever);
if (status != osOK) {
printf("app_msg: osMessageQueueGet failed.\n");
} else {
if (msg.len == 4U) {
cnt = *((uint32_t*)msg.data);
}
printf("app_msg: received [cmd = %d, data = 0x%0X]\n", msg.cmd, cnt);
}
}
}
/*----------------------------------------------------------------------------
* Main entry
*---------------------------------------------------------------------------*/
int main (void) {
// System Initialization
SystemCoreClockUpdate();
osKernelInitialize(); // Initialize CMSIS-RTOS
osThreadNew(app_main, NULL, NULL); // Create application main thread
osThreadNew(app_msg, NULL, &msgAttr); // Create message receiver thread
// Create message queue for up to 10 messages of type msg_t
msgQueue = osMessageQueueNew(10, sizeof(msg_t), NULL);
osKernelStart(); // Start thread execution
for (;;) {}
}