Skip to content

Commit d8be986

Browse files
committed
corrected typos
1 parent 305dd4d commit d8be986

File tree

6 files changed

+57
-25
lines changed

6 files changed

+57
-25
lines changed

‎estamosRTOS.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ void estamosRTOS_start(){
165165
#error Must implement MCU-specific code
166166
#endif
167167

168-
running->SP = running->buffer+STACK_SIZE; // Flush the firts task's stack
168+
running->SP = running->buffer+STACK_SIZE; // Flush the first task's stack
169169
estamosRTOS_asm_launch(); // Use the stack of the first task
170170
running->func(); // Call the first task's function
171171

‎estamosRTOS.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct TCB_NODE{
4949
typedef struct TCB_NODE TCB;
5050
typedef TCB task;
5151

52-
typedef uint32_t estamosRTOS_mutex;
52+
typedef uint32_t estamosRTOS_mutex; // TODO: Consider uint8_t
5353

5454
/*
5555
// These two symbols need to be defined in estamosRTOS_asm.s with the same values!!!!
@@ -77,7 +77,7 @@ void estamosRTOS_add_task(task *, t_funcPtr); // Adds a task to the runqueue
7777

7878
void estamosRTOS_start(void); // Launches the scheduler by:
7979
// - Wrapping the runqueue around
80-
// - Launching the SysTick interupt
80+
// - Launching the SysTick interrupt
8181
// - Moving the Main Stack Pointer to the first task's
8282
// allocated stack buffer
8383
// - Calling the first task's function
@@ -88,7 +88,7 @@ void estamosRTOS_asm_launch(void); // Assembly function that Moves the Main Sta
8888

8989
void estamosRTOS_scheduler(void); // C function that Performs the task switch.
9090
// The SysTick_Handler switches stack pointer spaces
91-
// by moving the MSP to the fits task's allocated buffer.
91+
// by moving the MSP to the next task's allocated buffer.
9292
// The SysTick_Handler is implemented in estamosRTOS_asm.s
9393

9494
uint32_t estamosRTOS_mutex_lock(estamosRTOS_mutex *); // Assembly function that locks a mutex.

‎estamosRTOS.uvoptx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
<sRunDeb>0</sRunDeb>
102102
<sLrtime>0</sLrtime>
103103
<bEvRecOn>1</bEvRecOn>
104+
<bSchkAxf>0</bSchkAxf>
105+
<bTchkAxf>0</bTchkAxf>
104106
<nTsel>0</nTsel>
105107
<sDll></sDll>
106108
<sDllPa></sDllPa>
@@ -240,33 +242,44 @@
240242
<pszMrule></pszMrule>
241243
<pSingCmds></pSingCmds>
242244
<pMultCmds></pMultCmds>
245+
<pMisraNamep></pMisraNamep>
246+
<pszMrulep></pszMrulep>
247+
<pSingCmdsp></pSingCmdsp>
248+
<pMultCmdsp></pMultCmdsp>
243249
<LogicAnalyzers>
244250
<Wi>
245251
<IntNumber>0</IntNumber>
246252
<FirstString>`t1</FirstString>
247-
<SecondString>FF0000000000000000000000000000000000F03F01000000000000000000000000000000743100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010000009A9999999999C93F1000000000000000000000000000000000000000A6050008</SecondString>
253+
<SecondString>FF8000000000000000000000000000000000F03F01000000000000000000000000000000743100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000010000009A9999999999C93F1300000000000000000000000000000000000000A6050008</SecondString>
248254
</Wi>
249255
<Wi>
250256
<IntNumber>1</IntNumber>
251257
<FirstString>`t2</FirstString>
252-
<SecondString>000080000000000000000000000000000000F03F01000000000000000000000000000000743200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000020000009A9999999999C93F1000000000000000000000000000000000000000A6050008</SecondString>
258+
<SecondString>000080000000000000000000000000000000F03F01000000000000000000000000000000743200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000020000009A9999999999C93F1300000000000000000000000000000000000000A6050008</SecondString>
253259
</Wi>
254260
<Wi>
255261
<IntNumber>2</IntNumber>
256262
<FirstString>`t3</FirstString>
257-
<SecondString>000000000000000000000000000000000000F03F01000000000000000000000000000000743300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000030000009A9999999999C93F1000000000000000000000000000000000000000A6050008</SecondString>
263+
<SecondString>008000000000000000000000000000000000F03F01000000000000000000000000000000743300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000030000009A9999999999C93F1300000000000000000000000000000000000000A6050008</SecondString>
258264
</Wi>
259265
<Wi>
260266
<IntNumber>3</IntNumber>
261267
<FirstString>`t4</FirstString>
262-
<SecondString>FF00000000000000000000000000000000E06F4001000000000000000000000000000000743400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000040000009A9999999999C93F10000000000000000000000000000000000000000C070008</SecondString>
268+
<SecondString>FF00000000000000000000000000000000E06F4001000000000000000000000000000000743400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000040000009A9999999999C93F13000000000000000000000000000000000000000C070008</SecondString>
263269
</Wi>
264270
<Wi>
265271
<IntNumber>4</IntNumber>
266272
<FirstString>`sched</FirstString>
267-
<SecondString>0080000000000000000000000000000000E06F4001000000000000000000000000000000736368656400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000050000009A9999999999C93F1000000000000000000000000000000000000000C4060008</SecondString>
273+
<SecondString>0080000000000000000000000000000000E06F4001000000000000000000000000000000736368656400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000050000009A9999999999C93F1300000000000000000000000000000000000000C4060008</SecondString>
268274
</Wi>
269275
</LogicAnalyzers>
276+
<DebugDescription>
277+
<Enable>1</Enable>
278+
<EnableFlashSeq>0</EnableFlashSeq>
279+
<EnableLog>0</EnableLog>
280+
<Protocol>2</Protocol>
281+
<DbgClock>10000000</DbgClock>
282+
</DebugDescription>
270283
</TargetOption>
271284
</Target>
272285

‎estamosRTOS.uvprojx‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<TargetName>Target 1</TargetName>
1111
<ToolsetNumber>0x4</ToolsetNumber>
1212
<ToolsetName>ARM-ADS</ToolsetName>
13-
<pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
13+
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
14+
<uAC6>0</uAC6>
1415
<TargetOption>
1516
<TargetCommonOption>
1617
<Device>STM32F303K8</Device>
@@ -132,7 +133,7 @@
132133
<UseExternalTool>0</UseExternalTool>
133134
<RunIndependent>0</RunIndependent>
134135
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
135-
<Capability>0</Capability>
136+
<Capability>1</Capability>
136137
<DriverSelection>-1</DriverSelection>
137138
</Flash1>
138139
<bUseTDR>1</bUseTDR>
@@ -183,6 +184,7 @@
183184
<hadXRAM>0</hadXRAM>
184185
<uocXRam>0</uocXRam>
185186
<RvdsVP>1</RvdsVP>
187+
<RvdsMve>0</RvdsMve>
186188
<hadIRAM2>0</hadIRAM2>
187189
<hadIROM2>0</hadIROM2>
188190
<StupSel>8</StupSel>
@@ -323,6 +325,7 @@
323325
<uThumb>0</uThumb>
324326
<uSurpInc>0</uSurpInc>
325327
<uC99>1</uC99>
328+
<uGnu>0</uGnu>
326329
<useXO>0</useXO>
327330
<v6Lang>1</v6Lang>
328331
<v6LangP>1</v6LangP>
@@ -417,6 +420,21 @@
417420
</Targets>
418421

419422
<RTE>
423+
<packages>
424+
<filter>
425+
<targetInfos/>
426+
</filter>
427+
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.0.1">
428+
<targetInfos>
429+
<targetInfo name="Target 1" versionMatchMode="fixed"/>
430+
</targetInfos>
431+
</package>
432+
<package name="STM32F3xx_DFP" schemaVersion="1.2" url="http://www.keil.com/pack/" vendor="Keil" version="1.4.0">
433+
<targetInfos>
434+
<targetInfo name="Target 1" versionMatchMode="fixed"/>
435+
</targetInfos>
436+
</package>
437+
</packages>
420438
<apis/>
421439
<components>
422440
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.0.1" condition="ARMv6_7_8-M Device">

‎estamosRTOS_asm.S‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ estamosRTOS_asm_launch PROC
5050
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5151
PendSV_Handler PROC ; R0-R3,R12,LR,PC,PSR saved by SysTick or other
5252
; tail-chained interrupt/exception.
53-
; CPSID I ; Prevent interrupt during switch
53+
CPSID I ; Prevent interrupt during switch
5454
PUSH {R4-R11} ; Save remaining regs r4-11
55-
LDR R0, =running ; R0 = pointer to running, old thread
55+
CLREX ; Invalidate the Exclusive Monitor for last LDREX
56+
LDR R0, =running ; R0 = pointer to running, old thread
5657
LDR R1, [R0] ; R1 = running
5758
STR SP, [R1] ; Save SP into TCB
5859
PUSH {R0,LR}
@@ -68,7 +69,7 @@ PendSV_Handler PROC ; R0-R3,R12,LR,PC,PSR saved by SysTick or other
6869
;#endif
6970
7071
POP {R4-R11} ; restore regs r4-11
71-
; CPSIE I ; tasks run with interrupts enabled
72+
CPSIE I ; tasks run with interrupts enabled
7273
BX LR ; restore R0-R3,R12,LR,PC,PSR
7374

7475
ENDP

‎main.c‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// estamosRTOS
22
// by Kuashio
33
//
4-
// Example application with 3 tasks.
4+
// Example application with 4 tasks.
55

66
// Uncomment the following line to enable debug mode
77
// #define ESTAMOSRTOS_DEBUG
@@ -14,17 +14,16 @@ volatile int shared=0, count=0;
1414
estamosRTOS_mutex my_mutex=0;
1515
uint8_t t1=0,t2=0,t3=0,t4=0;
1616

17-
#define ITERATIONS 2
17+
1818

1919
uint8_t iterations[4]={2,5,3,4};
2020

2121
void task1(){
2222
volatile int i=0, j=0, k=0;
2323
while(1){
24-
t1=t1?0:1;
25-
i=iterations[k++&0xf];
24+
i=iterations[k++&0x3];
2625
while(estamosRTOS_mutex_lock(&my_mutex)){
27-
//TODO: Yield();
26+
t1=t1?0:1;
2827
estamosRTOS_yield();
2928
}
3029
while(i--){
@@ -34,7 +33,7 @@ void task1(){
3433
}
3534
estamosRTOS_mutex_unlock(&my_mutex);
3635

37-
i=iterations[k++&0xf]*980;
36+
i=iterations[k++&0x3]*480;
3837
while(i--){
3938
j=40-i*j;
4039
j=60-i*7;
@@ -46,16 +45,17 @@ void task1(){
4645
void task2(){
4746
volatile int i=0, j=0, k=0;
4847
while(1){
49-
t2=t2?0:1;
48+
// t2=t2?0:1;
5049
i=20;
5150
i=30+j;
5251
j=40-i*j;
5352
i=j+50;
5453
j=60-i*7;
5554
i=j+70;
5655
i=80;
57-
i=iterations[k++&0xf];
56+
i=iterations[k++&0x3];
5857
while(estamosRTOS_mutex_lock(&my_mutex)){
58+
t2=t2?0:1;
5959
estamosRTOS_yield();
6060
}
6161
while(i--){
@@ -65,7 +65,7 @@ void task2(){
6565
}
6666
estamosRTOS_mutex_unlock(&my_mutex);
6767

68-
i=iterations[k++&0xf]*230;
68+
i=iterations[k++&0x3]*230;
6969
while(i--){
7070
j=40-i*j;
7171
j=60-i*7;
@@ -78,7 +78,7 @@ void task3(){
7878
volatile int i=0, j=0, k=0;
7979
while(1){
8080
t3=t3?0:1;
81-
i=iterations[k++&0xf];
81+
i=iterations[k++&0x3];
8282
if(!estamosRTOS_mutex_lock(&my_mutex)){
8383
while(i--){
8484
t3=t3?0:1;
@@ -101,7 +101,7 @@ void task4(){
101101
volatile int i=0, j=0, k=0;
102102
while(1){
103103
t4=t4?0:1;
104-
i=iterations[k++&0xf];
104+
i=iterations[k++&0x3];
105105
if(!estamosRTOS_mutex_lock(&my_mutex)){
106106
while(i--){
107107
t4=t4?0:1;

0 commit comments

Comments
 (0)