Merge branch 'master' of github.com:r0ket/r0ket
This commit is contained in:
commit
01e1077e25
|
@ -63,7 +63,7 @@ loadables: $(OUTFILE).bin
|
|||
clean:
|
||||
rm -f $(OBJS) $(LD_TEMP) $(OUTFILE).elf $(OUTFILE).bin $(OUTFILE).hex
|
||||
for dir in $(SUBDIRS); do \
|
||||
$(MAKE) --no-print-directory -C $$dir clean; \
|
||||
$(MAKE) $(CONFIG_MAKE_PRINTDIRECTORY) -C $$dir clean; \
|
||||
done
|
||||
flash: all
|
||||
../tools/bootloader/autoflash
|
||||
|
@ -79,7 +79,7 @@ flash: all
|
|||
subdirs: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) ROOT_PATH=../$(ROOT_PATH) --no-print-directory -C $@
|
||||
$(MAKE) ROOT_PATH=../$(ROOT_PATH) $(CONFIG_MAKE_PRINTDIRECTORY) -C $@
|
||||
|
||||
../tools/bootloader/lpcfix:
|
||||
cd ../tools/bootloader && $(MAKE)
|
||||
|
|
|
@ -42,3 +42,9 @@ CPU_TYPE = cortex-$(CORTEX_TYPE)
|
|||
|
||||
CFLAGS = -std=c99 -c -g -Os $(INCLUDE_PATHS) -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=$(CPU_TYPE) -DTARGET=$(TARGET) -DRAMCODE=$(RAMCODE) -fno-builtin
|
||||
LDFLAGS = -nostartfiles
|
||||
|
||||
|
||||
CONFIG_MAKE_PRINTDIRECTORY = --no-print-directory
|
||||
CONFIG_GCC_SHOWCOLUMN =
|
||||
|
||||
-include Makefile.sitespecific
|
||||
|
|
|
@ -41,6 +41,11 @@ endif
|
|||
# Compiler settings, parameters and flags
|
||||
##########################################################################
|
||||
|
||||
CFLAGS = -std=c99 -c -g -O0 $(INCLUDE_PATHS) -Wall -funsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -DRAMCODE=$(RAMCODE) -fno-builtin -DSIMULATOR -I$(ROOT_PATH)/../simcore -include libc-unc0llide.h
|
||||
CFLAGS = -std=c99 -c -g -O0 $(INCLUDE_PATHS) -Wall -funsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -DRAMCODE=$(RAMCODE) -fno-builtin -DSIMULATOR -I$(ROOT_PATH)/../simcore -include libc-unc0llide.h $(CONFIG_GCC_SHOWCOLUMN)
|
||||
#LDFLAGS = -nostartfiles
|
||||
|
||||
|
||||
CONFIG_MAKE_PRINTDIRECTORY = --no-print-directory
|
||||
CONFIG_GCC_SHOWCOLUMN =
|
||||
|
||||
-include Makefile.sitespecific
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/applications/initial.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/serial/config.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/serial/remote.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/serial/serial.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/serial/util.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/serial/uuid.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/config.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/font.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/funk.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/queue.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/util.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../../firmware/applications/tester/uuid.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/config.c"
|
|
@ -1,2 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include <time.h> /* need time_t in config_t */
|
||||
#include "../../../firmware/basic/idle.h"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/basic/itoa.c"
|
|
@ -1,231 +1,9 @@
|
|||
#warning "cleanupthisfile"
|
||||
#if 0
|
||||
#define systickInit _hideaway_systickInit
|
||||
#include "../../firmware/core/systick/systick.c"
|
||||
#else
|
||||
#undef systickInit
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file systick.c
|
||||
@author K. Townsend (microBuilder.eu)
|
||||
@date 22 March 2010
|
||||
@version 0.10
|
||||
|
||||
@section DESCRIPTION
|
||||
|
||||
Controls the 24-bit 'system tick' clock, which can be used as a
|
||||
generic timer or to control time sharing with an embedded real-time
|
||||
operating system (such as FreeRTOS).
|
||||
|
||||
@section Example
|
||||
|
||||
@code
|
||||
#include "core/cpu/cpu.h"
|
||||
#include "core/systick/systick.h"
|
||||
|
||||
void main (void)
|
||||
{
|
||||
cpuInit();
|
||||
|
||||
// Start systick timer with one tick every 10ms
|
||||
systickInit(10);
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2010, microBuilder SARL
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
#include "systick.h"
|
||||
|
||||
volatile uint32_t systickTicks = 0; // 1ms tick counter
|
||||
volatile uint32_t systickRollovers = 0;
|
||||
|
||||
void tick_wrapper(void);
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Systick interrupt handler
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void SysTick_Handler (void)
|
||||
{
|
||||
systickTicks++;
|
||||
|
||||
// Increment rollover counter
|
||||
if (systickTicks == 0xFFFFFFFF) systickRollovers++;
|
||||
|
||||
tick_wrapper();
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Configures the systick timer
|
||||
|
||||
@param[in] ticks
|
||||
The number of clock cycles between each tick of the
|
||||
systick timer. for example, 'CFG_CPU_CCLK / 1000' =
|
||||
1 millisecond. This value must not exceed 0x00FFFFFF.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
static uint32_t systickConfig(uint32_t ticks)
|
||||
{
|
||||
fprintf(stderr,"systickConfig: unimplemented\n");
|
||||
return 0;
|
||||
|
||||
// Check if 'ticks' is greater than maximum value
|
||||
if (ticks > SYSTICK_STRELOAD_MASK)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
// Reset counter
|
||||
systickTicks = 0;
|
||||
|
||||
// Set reload register
|
||||
SYSTICK_STRELOAD = (ticks & SYSTICK_STRELOAD_MASK) - 1;
|
||||
|
||||
// Load the systick counter value
|
||||
SYSTICK_STCURR = 0;
|
||||
|
||||
// Enable systick IRQ and timer
|
||||
SYSTICK_STCTRL = SYSTICK_STCTRL_CLKSOURCE |
|
||||
SYSTICK_STCTRL_TICKINT |
|
||||
SYSTICK_STCTRL_ENABLE;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Initialises the systick timer
|
||||
|
||||
@param[in] delayMs
|
||||
The number of milliseconds between each tick of the systick
|
||||
timer.
|
||||
|
||||
@note The shortest possible delay is 1 millisecond, which will
|
||||
allow fine grained delays, but will cause more load on the
|
||||
system than a 10mS delay. The resolution of the systick
|
||||
timer needs to be balanced with the amount of processing
|
||||
time you can spare. The delay should really only be set
|
||||
to 1 mS if you genuinely have a need for 1mS delays,
|
||||
otherwise a higher value like 5 or 10 mS is probably
|
||||
more appropriate.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void systickInit (uint32_t delayMs)
|
||||
{
|
||||
systickConfig ((CFG_CPU_CCLK / 1000) * delayMs);
|
||||
fprintf(stderr,"systickConfig %d: unimplemented\n",delayMs);
|
||||
// systickConfig ((CFG_CPU_CCLK / 1000) * delayMs);
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Causes a blocking delay for 'delayTicks' ticks on the
|
||||
systick timer. For example: systickDelay(100) would cause
|
||||
a blocking delay for 100 ticks of the systick timer.
|
||||
|
||||
@param[in] delayTicks
|
||||
The number of systick ticks to cause a blocking delay for
|
||||
|
||||
@Note This function takes into account the fact that the tick
|
||||
counter may eventually roll over to 0 once it reaches
|
||||
0xFFFFFFFF.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
void systickDelay (uint32_t delayTicks)
|
||||
{
|
||||
uint32_t curTicks;
|
||||
curTicks = systickTicks;
|
||||
|
||||
// Make sure delay is at least 1 tick in case of division, etc.
|
||||
if (delayTicks == 0) delayTicks = 1;
|
||||
|
||||
if (curTicks > 0xFFFFFFFF - delayTicks)
|
||||
{
|
||||
// Rollover will occur during delay
|
||||
while (systickTicks >= curTicks)
|
||||
{
|
||||
while (systickTicks < (delayTicks - (0xFFFFFFFF - curTicks)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((systickTicks - curTicks) < delayTicks);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the current value of the systick timer counter.
|
||||
This value is incremented by one every time an interrupt
|
||||
fires for the systick timer.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetTicks(void)
|
||||
{
|
||||
return systickTicks;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the current value of the systick timer rollover
|
||||
counter. This value is incremented by one every time the
|
||||
tick counter rolls over from 0xFFFFFFFF to 0.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetRollovers(void)
|
||||
{
|
||||
return systickRollovers;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@brief Returns the approximate number of seconds that the
|
||||
systick timer has been running.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
uint32_t systickGetSecondsActive(void)
|
||||
{
|
||||
uint32_t currentTick = systickTicks;
|
||||
uint32_t rollovers = systickRollovers;
|
||||
uint32_t secsActive = currentTick / (1000 / CFG_SYSTICK_DELAY_IN_MS);
|
||||
secsActive += rollovers * (0xFFFFFFFF / (1000 / CFG_SYSTICK_DELAY_IN_MS));
|
||||
|
||||
return secsActive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/usbcdc/util.c"
|
|
@ -0,0 +1,2 @@
|
|||
/* AUTOGENERATED SOURCE FILE */
|
||||
#include "../../../firmware/usbcdc/util.h"
|
|
@ -1,5 +1,10 @@
|
|||
project (qsimulat0r)
|
||||
cmake_minimum_required(VERSION 2.4.0)
|
||||
|
||||
if(POLICY CMP0015)
|
||||
cmake_policy(SET CMP0015 OLD)
|
||||
endif(POLICY CMP0015)
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../firmware ${CMAKE_CURRENT_SOURCE_DIR}/../firmware/core)
|
||||
|
@ -55,6 +60,9 @@ libfunk.a
|
|||
libusbcdc.a
|
||||
libbasic.a
|
||||
libcore.a
|
||||
|
||||
liblcd.a
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ using namespace std;
|
|||
|
||||
extern "C" {
|
||||
#include "basic/basic.h"
|
||||
#include "lcd/backlight.h"
|
||||
|
||||
#define lcdGetPixel __hideaway_lcdGetPixel
|
||||
#include "lcd/display.h"
|
||||
|
@ -86,14 +87,19 @@ public:
|
|||
painter.scale(1,1);
|
||||
QPoint pts[dimx*dimy];
|
||||
|
||||
pixmap.fill(0);
|
||||
// draw backlight
|
||||
const int backlight=backlightGetBrightness()*255/100;
|
||||
pixmap.setPixel(1,1,(QColor(backlight,backlight,backlight).rgb()));
|
||||
pixmap.fill(pixmap.pixel(1,1));
|
||||
|
||||
// draw lcd array
|
||||
for (int x = 0; x < dimx; ++x) {
|
||||
for(int y=0; y<dimy; ++y) {
|
||||
int color;
|
||||
if(lcd_layout & LCD_INVERTED) {
|
||||
color=lcdGetPixel((lcd_layout & LCD_MIRRORX)?(RESX-x-1):x,(lcd_layout & LCD_MIRRORY)?(RESY-y-1):y)?colorInvertedPixelOn:colorInvertedPixelOff;
|
||||
if(globalconfig.lcdstate & LCD_INVERTED) {
|
||||
color=lcdGetPixel((globalconfig.lcdstate & LCD_MIRRORX)?(RESX-x-1):x,(globalconfig.lcdstate & LCD_MIRRORY)?(RESY-y-1):y)?colorInvertedPixelOn:colorInvertedPixelOff;
|
||||
} else {
|
||||
color=lcdGetPixel((lcd_layout & LCD_MIRRORX)?(RESX-x-1):x,(lcd_layout & LCD_MIRRORY)?(RESY-y-1):y)?colorPixelOn:colorPixelOff;
|
||||
color=lcdGetPixel((globalconfig.lcdstate & LCD_MIRRORX)?(RESX-x-1):x,(globalconfig.lcdstate & LCD_MIRRORY)?(RESY-y-1):y)?colorPixelOn:colorPixelOff;
|
||||
}
|
||||
for(int minix=0; minix<pixw; ++minix) {
|
||||
for(int miniy=0; miniy<pixh; ++miniy) {
|
||||
|
@ -103,6 +109,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// draw leds
|
||||
const int x1=dimx*rasterx-1-ledsize;
|
||||
const int y1=dimy*rastery-1+2*ledsep+ledsize;
|
||||
drawLED(pixmap,0,x1,y1,colorGreenLED);
|
||||
|
@ -110,6 +117,7 @@ public:
|
|||
drawLED(pixmap,2,0,y1,colorGreenLED);
|
||||
drawLED(pixmap,3,x1,0,colorRedLED);
|
||||
|
||||
// finally output pixmap
|
||||
painter.drawImage(0,0,pixmap);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
#include "simulator.h"
|
||||
#include "../firmware/basic/basic.h"
|
||||
#include "../firmware/lcd/display.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
extern int lcd_layout;
|
||||
|
||||
void simlcdDisplayUpdate() {
|
||||
write(1,"\033[H",3);
|
||||
for(int y=0; y<RESY; ++y) {
|
||||
for(int x=0; x<RESX; ++x) {
|
||||
if(lcd_layout & LCD_INVERTED) {
|
||||
write(1,(lcdGetPixel((lcd_layout & LCD_MIRRORX)?(RESX-x-1):x,(lcd_layout & LCD_MIRRORY)?(RESY-y-1):y)?"#":"_"),1);
|
||||
if(globalconfig.lcdstate & LCD_INVERTED) {
|
||||
write(1,(lcdGetPixel((globalconfig.lcdstate & LCD_MIRRORX)?(RESX-x-1):x,(globalconfig.lcdstate & LCD_MIRRORY)?(RESY-y-1):y)?"#":"_"),1);
|
||||
} else {
|
||||
write(1,(lcdGetPixel((lcd_layout & LCD_MIRRORX)?(RESX-x-1):x,(lcd_layout & LCD_MIRRORY)?(RESY-y-1):y)?".":"@"),1);
|
||||
write(1,(lcdGetPixel((globalconfig.lcdstate & LCD_MIRRORX)?(RESX-x-1):x,(globalconfig.lcdstate & LCD_MIRRORY)?(RESY-y-1):y)?".":"@"),1);
|
||||
}
|
||||
}
|
||||
write(1,("\n"),1);
|
||||
|
|
Loading…
Reference in New Issue