Skip to content
Snippets Groups Projects
Commit 57ddb643 authored by Nikolay Amiantov's avatar Nikolay Amiantov
Browse files

Create libcard10-platform for shared constants

parent addcc9f6
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#include "card10-version.h"
#include "card10.h"
#include "card10-platform.h"
#include "led.h"
#include "pb.h"
#include "pmic.h"
......@@ -30,9 +31,6 @@
#define PARTITION_END (0x10000000 + 1024 * 1024 - 1)
#define MSC_MAGIC 0x6E697807
/* TODO: Make this address part of the linker script */
void* API_CALL_MEM = (void*)0x20080000;
DIR dir;
FATFS FatFs;
......@@ -75,7 +73,7 @@ int mount(void)
int get_msc_flag(void)
{
// We use the API call memory to store a magic value there.
uint32_t* flag = (uint32_t*)API_CALL_MEM;
uint32_t* flag = API_CALL_MEM_ADDRESS;
if (*flag == MSC_MAGIC) {
*flag = 0;
return 1;
......
......@@ -24,6 +24,7 @@ elf = executable(
version_hdr,
dependencies: [
libcard10,
libcard10_platform,
max32665_startup_boot,
libff13,
maxusb,
......
#pragma once
#include "epicardium.h"
#include "card10-platform.h"
#include <stdint.h>
#include <stdbool.h>
......@@ -49,6 +50,4 @@ struct api_call_mem {
uint8_t buffer[1];
};
/* TODO: Make this address part of the linker script */
static __attribute__((unused)) struct api_call_mem* API_CALL_MEM =
(struct api_call_mem*)0x20080000;
static __attribute__((unused)) struct api_call_mem* API_CALL_MEM = API_CALL_MEM_ADDRESS;
......@@ -24,13 +24,13 @@ api_caller_lib = static_library(
'api/caller.c',
'api/interrupt-receiver.c',
api[0], # Caller
dependencies: periphdriver,
dependencies: [periphdriver, libcard10_platform],
)
api_caller = declare_dependency(
include_directories: include_directories('.'),
link_with: api_caller_lib,
dependencies: periphdriver,
dependencies: [periphdriver, libcard10_platform],
)
api_dispatcher_lib = static_library(
......@@ -39,7 +39,7 @@ api_dispatcher_lib = static_library(
'api/interrupt-sender.c',
'api/control.c',
api[1], # Dispatcher
dependencies: [libcard10, periphdriver],
dependencies: [libcard10, libcard10_platform, periphdriver],
)
##########################################################################
......@@ -88,7 +88,7 @@ elf = executable(
l0der_sources,
ble_sources,
version_hdr,
dependencies: [libcard10, max32665_startup_core0, maxusb, libff13, ble, bhy1],
dependencies: [libcard10, libcard10_platform, max32665_startup_core0, maxusb, libff13, ble, bhy1],
link_with: [api_dispatcher_lib, freertos],
link_whole: [max32665_startup_core0_lib, board_card10_lib, newlib_heap_lib],
include_directories: [freertos_includes],
......
......@@ -6,6 +6,7 @@
#include "l0der/l0der.h"
#include "card10.h"
#include "card10-platform.h"
#include "FreeRTOS.h"
#include "task.h"
......@@ -17,7 +18,6 @@
#define PYCARDIUM_IVT (void *)0x10080000
#define BLOCK_WAIT pdMS_TO_TICKS(1000)
#define MSC_MAGIC 0x6E697807
/*
* Loading an empty filename into Pycardium will drop straight into the
......@@ -287,7 +287,7 @@ static void load_menu(bool reset)
void epic_system_reset(int to_bootloader)
{
// Set a flag for the bootloader.
uint32_t* flag = (uint32_t*)API_CALL_MEM;
uint32_t* flag = API_CALL_MEM_ADDRESS;
*flag = to_bootloader ? MSC_MAGIC : 0;
card10_reset();
......
#ifndef CARD10_PLATFORM_H
#define MSC_MAGIC 0x6E697807
/* TODO: Make this address part of the linker script */
#define API_CALL_MEM_ADDRESS ((void*)0x20080000)
#endif
includes = include_directories(
'./',
)
libcard10_platform = declare_dependency(
include_directories: includes,
)
......@@ -12,5 +12,6 @@ subdir('./FreeRTOS-Plus/')
subdir('./micropython/')
subdir('./card10/')
subdir('./card10-platform/')
subdir('./mx25lba/')
subdir('./ff13/')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment