Merge remote-tracking branch 'origin/task_prep'

This commit is contained in:
RedHawk 2023-04-05 00:17:24 +03:00
commit 409fb44d2c
4 changed files with 84 additions and 51 deletions

View File

@ -43,6 +43,7 @@
<option id="com.crt.advproject.cpp.fpu.1211390952" name="Floating point" superClass="com.crt.advproject.cpp.fpu" useByScannerDiscovery="true"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.417443680" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/lpc_chip_11u6x/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/shoh/freertos}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/shoh/freertos/inc}&quot;"/>
@ -275,31 +276,31 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="com.crt.config">
<projectStorage>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#13;
&lt;TargetConfig&gt;&#13;
&lt;Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/&gt;&#13;
&lt;infoList vendor="NXP"&gt;&#13;
&lt;info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"&gt;&#13;
&lt;chip&gt;&#13;
&lt;name&gt;LPC11U68&lt;/name&gt;&#13;
&lt;family&gt;LPC11U6x&lt;/family&gt;&#13;
&lt;vendor&gt;NXP (formerly Philips)&lt;/vendor&gt;&#13;
&lt;reset board="None" core="Real" sys="Real"/&gt;&#13;
&lt;clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/&gt;&#13;
&lt;memory can_program="true" id="Flash" is_ro="true" type="Flash"/&gt;&#13;
&lt;memory id="RAM" type="RAM"/&gt;&#13;
&lt;memory id="Periph" is_volatile="true" type="Peripheral"/&gt;&#13;
&lt;memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/&gt;&#13;
&lt;memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/&gt;&#13;
&lt;memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/&gt;&#13;
&lt;memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/&gt;&#13;
&lt;/chip&gt;&#13;
&lt;processor&gt;&#13;
&lt;name gcc_name="cortex-m0"&gt;Cortex-M0&lt;/name&gt;&#13;
&lt;family&gt;Cortex-M&lt;/family&gt;&#13;
&lt;/processor&gt;&#13;
&lt;/info&gt;&#13;
&lt;/infoList&gt;&#13;
<projectStorage>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;TargetConfig&gt;
&lt;Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/&gt;
&lt;infoList vendor="NXP"&gt;
&lt;info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"&gt;
&lt;chip&gt;
&lt;name&gt;LPC11U68&lt;/name&gt;
&lt;family&gt;LPC11U6x&lt;/family&gt;
&lt;vendor&gt;NXP (formerly Philips)&lt;/vendor&gt;
&lt;reset board="None" core="Real" sys="Real"/&gt;
&lt;clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/&gt;
&lt;memory can_program="true" id="Flash" is_ro="true" type="Flash"/&gt;
&lt;memory id="RAM" type="RAM"/&gt;
&lt;memory id="Periph" is_volatile="true" type="Peripheral"/&gt;
&lt;memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/&gt;
&lt;memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/&gt;
&lt;memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/&gt;
&lt;memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/&gt;
&lt;/chip&gt;
&lt;processor&gt;
&lt;name gcc_name="cortex-m0"&gt;Cortex-M0&lt;/name&gt;
&lt;family&gt;Cortex-M&lt;/family&gt;
&lt;/processor&gt;
&lt;/info&gt;
&lt;/infoList&gt;
&lt;/TargetConfig&gt;</projectStorage>
</storageModule>
<storageModule moduleId="com.crt.advproject">

View File

@ -4,38 +4,14 @@
#include "task.h"
#include <cr_section_macros.h>
#include "FreeRTOSCPP/Kernel.hpp"
#include "FreeRTOSCPP/Task.hpp"
class LedTask : public FreeRTOS::Task {
public:
LedTask(const UBaseType_t priority, const char* name)
: FreeRTOS::Task(priority, configMINIMAL_STACK_SIZE, name) {}
void taskFunction() final;
private:
int led;
};
// Task to be created.
void LedTask::taskFunction() {
bool LedState = false;
for (;;) {
Board_LED_Set(led, LedState);
LedState = (bool) !LedState;
led++;
if(led > 2){
led = 0;
}
vTaskDelay(configTICK_RATE_HZ / 2);
}
}
#include "threads/master/Master.h"
int main(void)
{
SystemCoreClockUpdate();
Board_Init();
// Create a task before starting the kernel.
LedTask task1((tskIDLE_PRIORITY + 1UL), "vTaskLed1");
Master master;
// Start the real time kernel with preemption.
FreeRTOS::Kernel::startScheduler();

View File

@ -0,0 +1,22 @@
/*
* Master.cpp
*
* Created on: 4 Apr 2023
* Author: tylen
*/
#include "Master.h"
void Master::taskFunction() {
bool LedState = true;
for (;;) {
Board_LED_Set(led, LedState);
LedState = (bool) !LedState;
led++;
if(led > 2){
led = 0;
}
vTaskDelay(1000);
}
}

View File

@ -0,0 +1,34 @@
/*
* Master.h
*
* Created on: 4 Apr 2023
* Author: tylen
*/
#ifndef THREADS_MASTER_MASTER_H_
#define THREADS_MASTER_MASTER_H_
#include "chip.h"
#include "board.h"
#include "FreeRTOSCPP/Task.hpp"
#include "FreeRTOSCPP/Kernel.hpp"
#include "task.h"
class Master : public FreeRTOS::Task {
public:
Master(): FreeRTOS::Task((tskIDLE_PRIORITY + 1UL),
configMINIMAL_STACK_SIZE * 10,
"master"){};
virtual ~Master() = default;
Master(Master&&) noexcept = default;
Master& operator=(Master&&) noexcept = default;
void taskFunction();
private:
int led;
};
#endif /* THREADS_MASTER_MASTER_H_ */