This commit is contained in:
Ilmir Usmanov
2014-07-10 11:26:52 +04:00
parent 2d4b325d24
commit 99464d6ca7
5 changed files with 135 additions and 26 deletions
+27
View File
@@ -0,0 +1,27 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "error.h"
extern void lexer_dump_buffer_state (void);
void
fatal (int code)
{
printf ("FATAL: %d\n", code);
lexer_dump_buffer_state ();
JERRY_UNREACHABLE ();
exit (code);
}
-2
View File
@@ -18,8 +18,6 @@
#include "mappings.h"
extern void lexer_dump_buffer_state (void);
void fatal (int);
#define ERR_IO (-1)
-5
View File
@@ -38,11 +38,6 @@ gen_bytecode ()
// save_op_data (3, getop_call_1 (0, 14));
// save_op_data (4, getop_call_1 (0, 15));
// save_op_data (5, getop_jmp (0));
#ifdef __MCU
// It's mandatory to restart app!
save_op_data (getop_jmp (0));
#endif
}
void
+59 -3
View File
@@ -14,9 +14,20 @@
*/
#ifdef JERRY_NDEBUG
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
#ifdef __TARGET_MCU
#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#define LED_GREEN 12
#define LED_ORANGE 13
#define LED_RED 14
#define LED_BLUE 15
#endif
#include "error.h"
@@ -33,7 +44,52 @@ void fake_exit (void);
void
fake_exit (void)
{
#ifdef __TARGET_MCU
int pin = LED_RED;
uint32_t mode = GPIO_Mode_OUT << (pin * 2);
uint32_t speed = GPIO_Speed_100MHz << (pin * 2);
uint32_t type = GPIO_OType_PP << pin;
uint32_t pullup = GPIO_PuPd_NOPULL << (pin * 2);
//
// Initialise the peripheral clock.
//
RCC->AHB1ENR |= RCC_AHB1Periph_GPIOD;
//
// Initilaise the GPIO port.
//
GPIOD->MODER |= mode;
GPIOD->OSPEEDR |= speed;
GPIOD->OTYPER |= type;
GPIOD->PUPDR |= pullup;
//
// Toggle the selected LED indefinitely.
//
int index;
// SOS
int dot = 600000;
int dash = dot * 3;
while (1)
{
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dash; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dash; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dash; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin); for (index = 0; index < dash; index++);
GPIOD->BSRRL = (1 << pin); for (index = 0; index < dot; index++); GPIOD->BSRRH = (1 << pin);
for (index = 0; index < dash * 7; index++);
}
#else
for (;;);
#endif
}
int