Support of STM32F3 board.

This commit is contained in:
Ruben Ayrapetyan
2014-10-17 21:48:09 +04:00
parent 9c1428de29
commit 8e1156bd9e
12 changed files with 1788 additions and 489 deletions
+103
View File
@@ -0,0 +1,103 @@
/**
* Runtime ABI for ARM architecture
*/
/**
* long long __aeabi_llsl(long long {r1, r0}, int {r2})
*/
.thumb_func
.global __aeabi_llsl
__aeabi_llsl:
// if (r2 >= 64) goto 2f;
cmp r2, #64
bhs 2f
// if (r2 < 32) goto 1f;
cmp r2, #32
blo 1f
// r1 = (r0 << (r2 - 32));
// r0 = 0;
sub r2, #32
mov r1, r0
lsl r1, r2
mov r0, #0
bx lr
1:
// r1 <<= r2;
lsl r1, r2
// r2 = 32 - r2;
rsb r2, r2, #32
// r1 |= (r0 >> r2);
mov r3, r0
lsr r3, r2
orr r1, r3
// r2 = 32 - r2;
rsb r2, r2, #32
// r0 <<= r2;
lsl r0, r2
bx lr
2:
// r1 = 0;
// r0 = 0;
mov r1, #0
mov r0, #0
bx lr
/**
* long long __aeabi_llsr(long long {r1, r0}, int {r2})
*/
.thumb_func
.global __aeabi_llsr
__aeabi_llsr:
// if (r2 >= 64) goto 2f;
cmp r2, #64
bhs 2f
// if (r2 < 32) goto 1f;
cmp r2, #32
blo 1f
// r0 = (r1 >> (r2 - 32));
// r1 = 0
sub r2, #32
mov r0, r1
lsr r0, r2
mov r1, #0
bx lr
1:
// r0 >>= r2
lsr r0, r2
// r0 |= r1 << (32 - r2)
mov r3, r1
rsb r2, r2, #32
lsl r3, r3, r2
orr r0, r3
rsb r2, r2, #32
// r1 >>= r2
lsr r1, r2
bx lr
2:
// r1 = 0;
// r0 = 0;
mov r1, #0
mov r0, #0
bx lr
@@ -0,0 +1,55 @@
/* 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 "globals.h"
#include "jerry-libc.h"
/**
* Handle failed assertion
*/
void __noreturn
jerry_assert_fail (const char *assertion __unused, /**< assertion condition string */
const char *file __unused, /**< file name */
const char *function __unused, /**< function name */
const uint32_t line __unused) /** line */
{
__exit (-ERR_FAILED_INTERNAL_ASSERTION);
} /* jerry_assert_fail */
/**
* Handle execution of control path that should be unreachable
*/
void __noreturn
jerry_unreachable (const char *comment __unused, /**< comment to unreachable mark if exists,
NULL - otherwise */
const char *file __unused, /**< file name */
const char *function __unused, /**< function name */
const uint32_t line __unused) /**< line */
{
__exit (-ERR_FAILED_INTERNAL_ASSERTION);
} /* jerry_unreachable */
/**
* Handle unimplemented case execution
*/
void __noreturn
jerry_unimplemented (const char *comment __unused, /**< comment to unimplemented mark if exists,
NULL - otherwise */
const char *file __unused, /**< file name */
const char *function __unused, /**< function name */
const uint32_t line __unused) /**< line */
{
__exit (-ERR_UNIMPLEMENTED_CASE);
} /* jerry_unimplemented */
@@ -0,0 +1,59 @@
/* 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.
*/
/**
* Jerry libc platform-specific functions stm32f4 implementation
*/
#include "jerry-libc.h"
#include <stdarg.h>
extern void __noreturn exit (int status);
/** Output of character. Writes the character c, cast to an unsigned char, to stdout. */
int
__putchar (int c)
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(c);
} /* __putchar */
/** exit - cause normal process termination */
void __noreturn
__exit (int status __unused)
{
/**
* TODO: Blink LEDs? status -> binary -> LEDs?
*/
while (true)
{
}
} /* __exit */
/**
* fwrite
*
* @return number of bytes written
*/
size_t
__fwrite (const void *ptr, /**< data to write */
size_t size, /**< size of elements to write */
size_t nmemb, /**< number of elements */
_FILE *stream) /**< stream pointer */
{
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS(ptr, size, nmemb, stream);
} /* __fwrite */