Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Alexandre Malecot
freertos-cu-gps
Commits
c3fd9424
Commit
c3fd9424
authored
May 25, 2018
by
Colin González
Browse files
Trying different disable interrupt
parent
0e949aab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
33 deletions
+45
-33
Makefile
Makefile
+10
-6
src/flashing/flash.sh
src/flashing/flash.sh
+1
-1
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portISR.c
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portISR.c
+17
-10
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portmacro.h
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portmacro.h
+8
-5
src/main.c
src/main.c
+9
-11
No files found.
Makefile
View file @
c3fd9424
...
...
@@ -15,7 +15,7 @@ BOARD = at91sam9g20-ek
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL
=
5
#
TRACE_LEVEL = 5
AT91LIB
=
src/at91lib
FREERTOS
=
src/freertos
...
...
@@ -61,11 +61,15 @@ INCLUDES += -I$(FREERTOS)/include
INCLUDES
+=
-I
$(FREERTOS)
INCLUDES
+=
-Isrc
/
OPTIM
=
-O3
CFLAGS
=
-Wall
-mlong-calls
-ffunction-sections
#CFLAGS += -mthumb-interwork -D THUMB_INTERWORK
CFLAGS
+=
-g
$(INCLUDES)
-D
$(CHIP)
-DTRACE_LEVE
=
$(TRACE_LEVEL)
ASFLAGS
=
-Wall
-g
$(INCLUDES)
-D
$(CHIP)
-D__ASSEMBLY__
LDFLAGS
=
-g
-nostartfiles
-Wl
,--gc-sections
CFLAGS
+=
-fomit-frame-pointer
-fno-strict-aliasing
-fno-dwarf2-cfi-asm
CFLAGS
+=
-mthumb-interwork
-D
THUMB_INTERWORK
CFLAGS
+=
-g
$(OPTIM)
$(INCLUDES)
-D
$(CHIP)
# -DTRACE_LEVE=$(TRACE_LEVEL)
ASFLAGS
=
-Wall
-g
$(OPTIM)
$(INCLUDES)
-D
$(CHIP)
-D__ASSEMBLY__
LDFLAGS
=
-mthumb
-g
$(OPTIM)
-nostartfiles
-Wl
,--gc-sections
#-------------------------------------------------------------------------------
# FILES
...
...
@@ -156,7 +160,7 @@ $$(ARM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC)
$(CFLAGS)
-D
$(1)
-c
-o
$$
@
$$
<
$$(C_OBJECTS_$(1))
:
$(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC)
$(CFLAGS)
-D
$(1)
-c
-o
$$
@
$$
<
$(CC)
$(CFLAGS)
-mthumb
-D
$(1)
-c
-o
$$
@
$$
<
$$(ASM_OBJECTS_$(1))
:
$(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC)
$(ASFLAGS)
-D
$(1)
-c
-o
$$
@
$$
<
...
...
src/flashing/flash.sh
View file @
c3fd9424
#! /bin/sh
sam-ba /dev/ttyACM0 at91sam9g20-ek src/flashing/
nand-flash
.tcl
>
flash.log 2>&1
sam-ba /dev/ttyACM0 at91sam9g20-ek src/flashing/
sdram
.tcl
>
flash.log 2>&1
true
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portISR.c
View file @
c3fd9424
...
...
@@ -30,6 +30,7 @@ void vPortTickISR( void );
void
vPortTickISR
(
void
)
{
portSAVE_CONTEXT
();
volatile
uint32_t
ulDummy
;
volatile
uint32_t
status
;
// Read the PIT status register
...
...
@@ -44,7 +45,7 @@ void vPortTickISR( void )
//Returns the number of occurrences of periodic intervals since the last read of PIT_PIVR.
ulDummy
+=
(
PIT_GetPIVR
()
>>
20
);
}
portRESTORE_CONTEXT
();
/* Increment the tick count - which may wake some tasks but as the
preemptive scheduler is not being used any woken task is not given
processor time no matter what its priority. */
...
...
@@ -67,9 +68,11 @@ void vPortDisableInterruptsFromThumb( void )
{
__asm
volatile
(
"STMDB SP!, {R0}
\n\t
"
/* Push R0. */
"MRS R0, CPSR
\n\t
"
/* Get CPSR. */
"ORR R0, R0, #0xC0
\n\t
"
/* Disable IRQ, FIQ. */
"MSR CPSR, R0
\n\t
"
/* Write back modified value. */
"MRS R0, CPSR
\n\t
"
/* Get CPSR. */
"ORR R0, R0, #0x80
\n
"
"MSR CPSR, R0
\n
"
"ORR R0, R0, #0x40
\n
"
"MSR CPSR, R0
\n\t
"
"LDMIA SP!, {R0}
\n\t
"
/* Pop R0. */
"BX R14"
);
/* Return back to thumb. */
}
...
...
@@ -95,12 +98,16 @@ in a variable, which is then saved as part of the stack context. */
void
vPortEnterCritical
(
void
)
{
/* Disable interrupts as per portDISABLE_INTERRUPTS(); */
__asm
volatile
(
"STMDB SP!, {R0}
\n\t
"
/* Push R0. */
"MRS R0, CPSR
\n\t
"
/* Get CPSR. */
"ORR R0, R0, #0xC0
\n\t
"
/* Disable IRQ, FIQ. */
"MSR CPSR, R0
\n\t
"
/* Write back modified value. */
"LDMIA SP!, {R0}"
);
/* Pop R0. */
__asm
volatile
(
"STMDB SP!, {R0}
\n\t
"
/* Push R0. */
"MRS R0, CPSR
\n\t
"
/* Get CPSR. */
"ORR R0, R0, #0x80
\n
"
"MSR CPSR, R0
\n
"
"ORR R0, R0, #0x40
\n
"
"MSR CPSR, R0
\n\t
"
"LDMIA SP!, {R0}
\n\t
"
/* Pop R0. */
"BX R14"
);
/* Now interrupts are disabled ulCriticalNesting can be accessed
directly. Increment ulCriticalNesting to keep a count of how many times
...
...
src/freertos/portable/GCC/ARM9_AT91SAM9G20/portmacro.h
View file @
c3fd9424
...
...
@@ -150,11 +150,14 @@ typedef unsigned long UBaseType_t;
#define portDISABLE_INTERRUPTS()\
__asm
volatile
(
\
"STMDB SP!, {R0}
\n
"
\
"MRS R0, CPSR
\n
"
\
"ORR R0, R0, #0xC0
\n
"
\
"MSR CPSR, R0
\n
"
\
"LDMIA SP!, {R0}
\n
"
)
"STMDB SP!, {R0}
\n
"
\
"MRS R0, CPSR
\n
"
\
"ORR R0, R0, #0x80
\n
"
\
"MSR CPSR, R0
\n
"
\
"ORR R0, R0, #0x40
\n
"
\
"MSR CPSR, R0
\n
"
"LDMIA SP!, {R0}
\n
"
\
"BX R14"
)
#define portENABLE_INTERRUPTS()\
__asm
volatile
(
\
...
...
src/main.c
View file @
c3fd9424
#include <board.h>
#include <pio/pio.h>
#include <pio/pio_it.h>
#if defined(AT91C_BASE_PITC)
#include <pit/pit.h>
#endif
#include <irq/irq.h>
#include <tc/tc.h>
#include <utility/led.h>
#include <utility/trace.h>
#include <stdio.h>
...
...
@@ -85,9 +78,15 @@ void ConfigureLeds (void) {
LED_Configure
(
1
);
}
int
main
()
{
static
void
prvSetupHardware
(
void
)
{
AT91C_BASE_AIC
->
AIC_EOICR
=
0
;
ConfigureLeds
();
}
int
main
()
{
prvSetupHardware
();
LED_Set
(
1
);
/* TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); */
/* printf("-- Template project %s --\n\r", SOFTPACK_VERSION); */
/* printf("-- %s\n\r", BOARD_NAME); */
...
...
@@ -96,9 +95,8 @@ int main () {
/* int x = many_test(); */
/* printf("--Testouch %d \n\r", x); */
xTaskCreate
(
task1
,
"LED_0"
,
128
,
NULL
,
0
,
NULL
);
xTaskCreate
(
task2
,
"LED_1"
,
128
,
NULL
,
0
,
NULL
);
/* xTaskCreate(task1, "LED_0", 128, NULL, 0, NULL); */
/* xTaskCreate(task2, "LED_1", 128, NULL, 0, NULL); */
vTaskStartScheduler
();
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment