Skip to content

Commit

Permalink
templates: semihosting argv[1] loops
Browse files Browse the repository at this point in the history
  • Loading branch information
ilg-ul committed Apr 6, 2015
1 parent 40e5f20 commit f88fefc
Show file tree
Hide file tree
Showing 31 changed files with 281 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
// ----------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include "diag/Trace.h"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

timer_start();

blink_led_init();

uint32_t seconds = 0;

// Infinite loop
while (1)
{
blink_led_on();
timer_sleep(BLINK_ON_TICKS);

blink_led_off();
timer_sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Timer timer;
timer.start();

BlinkLed blinkLed;

// Perform all necessary initialisations for the LED.
blinkLed.powerUp();

uint32_t seconds = 0;

// Infinite loop
while (1)
{
blinkLed.turnOn();
timer.sleep(BLINK_ON_TICKS);

blinkLed.turnOff();
timer.sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

// Infinite loop
while (1)
{
// Add your code here.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

timer_start();

blink_led_init();

uint32_t seconds = 0;

// Infinite loop
while (1)
{
blink_led_on();
timer_sleep(BLINK_ON_TICKS);

blink_led_off();
timer_sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Timer timer;
timer.start();

BlinkLed blinkLed;

// Perform all necessary initialisations for the LED.
blinkLed.powerUp();

uint32_t seconds = 0;

// Infinite loop
while (1)
{
blinkLed.turnOn();
timer.sleep(BLINK_ON_TICKS);

blinkLed.turnOff();
timer.sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

// Infinite loop
while (1)
{
// Add your code here.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

timer_start();

blink_led_init();

uint32_t seconds = 0;

#define LOOP_COUNT (5)
int loops = LOOP_COUNT;
if (argc > 1)
{
// If defined, get the number of loops from the command line,
// configurable via semihosting.
loops = atoi (argv[1]);
}

// Short loop.
for (int i = 0; i < loops; i++)
{
blink_led_on();
timer_sleep(BLINK_ON_TICKS);

blink_led_off();
timer_sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

Timer timer;
timer.start();

BlinkLed blinkLed;

// Perform all necessary initialisations for the LED.
blinkLed.powerUp();

uint32_t seconds = 0;

#define LOOP_COUNT (5)
int loops = LOOP_COUNT;
if (argc > 1)
{
// If defined, get the number of loops from the command line,
// configurable via semihosting.
loops = atoi (argv[1]);
}

// Short loop.
for (int i = 0; i < loops; i++)
{
blinkLed.turnOn();
timer.sleep(BLINK_ON_TICKS);

blinkLed.turnOff();
timer.sleep(BLINK_OFF_TICKS);

++seconds;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

#define LOOP_COUNT (5)
int loops = LOOP_COUNT;
if (argc > 1)
{
// If defined, get the number of loops from the command line,
// configurable via semihosting.
loops = atoi (argv[1]);
}

// Short loop.
for (int i = 0; i < loops; i++)
{
// Add your code here.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
}
// Infinite loop, never return.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
}
// Infinite loop, never return.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return 0;
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
//@XCDL @if "$(content)"=="blinky"
//@XCDL @include "$(commonDir)/src/main/main-180-$(syscalls)-hello.c"
//@XCDL @include "$(commonDir)/src/main/main-190-clock-blinky.c"
//@XCDL @include "$(commonDir)/src/main/main-200-loop-blinky.$(fileExtension)"
//@XCDL @include "$(commonDir)/src/main/main-200-$(syscalls)-loop-blinky.$(fileExtension)"
//@XCDL @include "$(commonDir)/src/main/main-210-print.c"
//@XCDL @include "$(commonDir)/src/main/main-220-loopend.c"
//@XCDL @include "$(commonDir)/src/main/main-220-$(syscalls)-loopend.c"
//@XCDL @elif "$(content)"=="empty"
//@XCDL @include "$(commonDir)/src/main/main-190-clock-empty.c"
//@XCDL @include "$(commonDir)/src/main/main-200-loop-empty.c"
//@XCDL @include "$(commonDir)/src/main/main-200-$(syscalls)-loop-empty.c"
//@XCDL @endif
//@XCDL @include "$(commonDir)/src/main/main-230-end.c"
//@XCDL @include "$(commonDir)/src/main/main-230-$(syscalls)-end.c"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// ----------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>

#include "diag/Trace.h"
#include "Timer.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

int seconds = 0;

// Infinite loop
while (1)
{
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

int seconds = 0;

// Infinite loop
while (1)
{
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

int seconds = 0;

#define LOOP_COUNT (5)
int loops = LOOP_COUNT;
if (argc > 1)
{
// If defined, get the number of loops from the command line,
// configurable via semihosting.
loops = atoi (argv[1]);
}

// Short loop.
for (int i = 0; i < loops; i++)
{
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

++seconds;

// Count seconds on the trace device.
trace_printf ("Second %d\n", seconds);
}
// Infinite loop, never return.
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

++seconds;

// Count seconds on the trace device.
trace_printf ("Second %d\n", seconds);
}
// Infinite loop, never return.
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

++seconds;

// Count seconds on the trace device.
trace_printf ("Second %d\n", seconds);
}
return 0;
}

#pragma GCC diagnostic pop

// ----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ and is available athttp://www.eclipse.org/legal/epl-v10.html"
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="src/main-30.c" />
<simple name="source" value="src/main-30-$(syscalls).c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand All @@ -343,7 +343,7 @@ and is available athttp://www.eclipse.org/legal/epl-v10.html"
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="src/main-50.c" />
<simple name="source" value="src/main-50-$(syscalls).c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ and is available athttp://www.eclipse.org/legal/epl-v10.html"
</element>
<element>
<simple name="source"
value="$(commonDir)/src/main/main-200-loop-blinky.$(fileExtension)" />
value="$(commonDir)/src/main/main-200-$(syscalls)-loop-blinky.$(fileExtension)" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand All @@ -407,12 +407,12 @@ and is available athttp://www.eclipse.org/legal/epl-v10.html"
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-220-loopend.c" />
<simple name="source" value="$(commonDir)/src/main/main-220-$(syscalls)-loopend.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-230-end.c" />
<simple name="source" value="$(commonDir)/src/main/main-230-$(syscalls)-end.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand Down Expand Up @@ -532,12 +532,12 @@ and is available athttp://www.eclipse.org/legal/epl-v10.html"
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-200-loop-empty.c" />
<simple name="source" value="$(commonDir)/src/main/main-200-$(syscalls)-loop-empty.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-230-end.c" />
<simple name="source" value="$(commonDir)/src/main/main-230-$(syscalls)-end.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
</element>
<element>
<simple name="source"
value="$(commonDir)/src/main/main-200-loop-blinky.$(fileExtension)" />
value="$(commonDir)/src/main/main-200-$(syscalls)-loop-blinky.$(fileExtension)" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand All @@ -368,12 +368,12 @@
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-220-loopend.c" />
<simple name="source" value="$(commonDir)/src/main/main-220-$(syscalls)-loopend.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-230-end.c" />
<simple name="source" value="$(commonDir)/src/main/main-230-$(syscalls)-end.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand Down Expand Up @@ -493,12 +493,12 @@
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-200-loop-empty.c" />
<simple name="source" value="$(commonDir)/src/main/main-200-$(syscalls)-loop-empty.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
<element>
<simple name="source" value="$(commonDir)/src/main/main-230-end.c" />
<simple name="source" value="$(commonDir)/src/main/main-230-$(syscalls)-end.c" />
<simple name="target" value="$(sourceDir)/main.$(fileExtension)" />
<simple name="replaceable" value="true" />
</element>
Expand Down
Loading

0 comments on commit f88fefc

Please sign in to comment.