Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
fb06bfc1
Commit
fb06bfc1
authored
Apr 17, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stmhal: Clean up fatality indications; remove long-obsolete malloc0.c.
parent
c9f6f6b8
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
stmhal/Makefile
+0
-1
0 additions, 1 deletion
stmhal/Makefile
stmhal/main.c
+18
-18
18 additions, 18 deletions
stmhal/main.c
stmhal/malloc0.c
+0
-37
0 additions, 37 deletions
stmhal/malloc0.c
stmhal/std.h
+0
-2
0 additions, 2 deletions
stmhal/std.h
stmhal/stm32f4xx_it.c
+13
-21
13 additions, 21 deletions
stmhal/stm32f4xx_it.c
with
31 additions
and
79 deletions
stmhal/Makefile
+
0
−
1
View file @
fb06bfc1
...
...
@@ -71,7 +71,6 @@ SRC_C = \
printf.c
\
math.c
\
mathsincos.c
\
malloc0.c
\
gccollect.c
\
pybstdio.c
\
readline.c
\
...
...
This diff is collapsed.
Click to expand it.
stmhal/main.c
+
18
−
18
View file @
fb06bfc1
#include
<stdio.h>
#include
<string.h>
#include
<stm32f4xx_hal.h>
#include
<stm32f4xx_hal_gpio.h>
#include
"std.h"
#include
"stm32f4xx_hal.h"
#include
"misc.h"
#include
"systick.h"
...
...
@@ -14,11 +12,10 @@
#include
"lexer.h"
#include
"parse.h"
#include
"obj.h"
#include
"parsehelper.h"
#include
"compile.h"
#include
"runtime.h"
#include
"gc.h"
#include
"gccollect.h"
#include
"pybstdio.h"
#include
"readline.h"
#include
"pyexec.h"
#include
"usart.h"
...
...
@@ -64,12 +61,25 @@ void flash_error(int n) {
}
void
__fatal_error
(
const
char
*
msg
)
{
#if MICROPY_HW_HAS_LCD
for
(
volatile
uint
delay
=
0
;
delay
<
10000000
;
delay
++
)
{
}
led_state
(
1
,
1
);
led_state
(
2
,
1
);
led_state
(
3
,
1
);
led_state
(
4
,
1
);
stdout_tx_strn
(
"
\n
FATAL ERROR:
\n
"
,
14
);
stdout_tx_strn
(
msg
,
strlen
(
msg
));
#if 0 && MICROPY_HW_HAS_LCD
lcd_print_strn("\nFATAL ERROR:\n", 14);
lcd_print_strn(msg, strlen(msg));
#endif
for
(;;)
{
flash_error
(
1
);
for
(
uint
i
=
0
;;)
{
led_toggle
(((
i
++
)
&
3
)
+
1
);
for
(
volatile
uint
delay
=
0
;
delay
<
10000000
;
delay
++
)
{
}
if
(
i
>=
8
)
{
__WFI
();
}
}
}
...
...
@@ -109,16 +119,6 @@ STATIC mp_obj_t pyb_usb_mode(mp_obj_t usb_mode) {
MP_DEFINE_CONST_FUN_OBJ_1
(
pyb_usb_mode_obj
,
pyb_usb_mode
);
void
fatality
(
void
)
{
led_state
(
PYB_LED_R1
,
1
);
led_state
(
PYB_LED_G1
,
1
);
led_state
(
PYB_LED_R2
,
1
);
led_state
(
PYB_LED_G2
,
1
);
for
(;;)
{
flash_error
(
1
);
}
}
static
const
char
fresh_boot_py
[]
=
"# boot.py -- run on boot-up
\n
"
"# can run arbitrary Python, but best to keep it minimal
\n
"
...
...
This diff is collapsed.
Click to expand it.
stmhal/malloc0.c
deleted
100644 → 0
+
0
−
37
View file @
c9f6f6b8
#include
<stdio.h>
#include
<stdint.h>
#include
"misc.h"
#include
"mpconfig.h"
#include
"gc.h"
#if 0
static uint32_t mem = 0;
void *malloc(size_t n) {
if (mem == 0) {
extern uint32_t _heap_start;
mem = (uint32_t)&_heap_start; // need to use big ram block so we can execute code from it (is it true that we can't execute from CCM?)
}
void *ptr = (void*)mem;
mem = (mem + n + 3) & (~3);
if (mem > 0x20000000 + 0x18000) {
void __fatal_error(const char*);
__fatal_error("out of memory");
}
return ptr;
}
void free(void *ptr) {
}
void *realloc(void *ptr, size_t n) {
return malloc(n);
}
#endif
void
__assert_func
(
void
)
{
printf
(
"
\n
ASSERT FAIL!"
);
for
(;;)
{
}
}
This diff is collapsed.
Click to expand it.
stmhal/std.h
+
0
−
2
View file @
fb06bfc1
typedef
unsigned
int
size_t
;
void
__assert_func
(
void
);
void
*
memcpy
(
void
*
dest
,
const
void
*
src
,
size_t
n
);
void
*
memmove
(
void
*
dest
,
const
void
*
src
,
size_t
n
);
void
*
memset
(
void
*
s
,
int
c
,
size_t
n
);
...
...
This diff is collapsed.
Click to expand it.
stmhal/stm32f4xx_it.c
+
13
−
21
View file @
fb06bfc1
...
...
@@ -64,7 +64,7 @@
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
extern
void
fatal
ity
(
);
extern
void
__
fatal
_error
(
const
char
*
);
extern
PCD_HandleTypeDef
hpcd
;
/* Private function prototypes -----------------------------------------------*/
...
...
@@ -88,12 +88,10 @@ void NMI_Handler(void)
* @param None
* @retval None
*/
void
HardFault_Handler
(
void
)
{
void
HardFault_Handler
(
void
)
{
/* Go to infinite loop when Hard Fault exception occurs */
while
(
1
)
{
fatality
();
while
(
1
)
{
__fatal_error
(
"HardFault"
);
}
}
...
...
@@ -102,12 +100,10 @@ void HardFault_Handler(void)
* @param None
* @retval None
*/
void
MemManage_Handler
(
void
)
{
void
MemManage_Handler
(
void
)
{
/* Go to infinite loop when Memory Manage exception occurs */
while
(
1
)
{
fatality
();
while
(
1
)
{
__fatal_error
(
"MemManage"
);
}
}
...
...
@@ -116,12 +112,10 @@ void MemManage_Handler(void)
* @param None
* @retval None
*/
void
BusFault_Handler
(
void
)
{
void
BusFault_Handler
(
void
)
{
/* Go to infinite loop when Bus Fault exception occurs */
while
(
1
)
{
fatality
();
while
(
1
)
{
__fatal_error
(
"BusFault"
);
}
}
...
...
@@ -130,12 +124,10 @@ void BusFault_Handler(void)
* @param None
* @retval None
*/
void
UsageFault_Handler
(
void
)
{
void
UsageFault_Handler
(
void
)
{
/* Go to infinite loop when Usage Fault exception occurs */
while
(
1
)
{
fatality
();
while
(
1
)
{
__fatal_error
(
"UsageFault"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment