Skip to content

Commit

Permalink
hw/mcu/MK8xF: Use autogenerated linker script
Browse files Browse the repository at this point in the history
This switches to autogenerated linker scripts for CortexM.

Signed-off-by: Jerzy Kasenberg <[email protected]>
  • Loading branch information
kasjer committed Nov 5, 2024
1 parent e996583 commit 5e45350
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 296 deletions.
1 change: 0 additions & 1 deletion .rat-excludes
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ startup_MK64F12.S
MK82FN256xxx15_flash.ld
boot-MK82FN256xxx15_flash.ld
startup_MK82F25615.S
system_MK82F25615.c
fsl_ftfx_controller.c

# LWIP - BSD License.
Expand Down
5 changes: 1 addition & 4 deletions hw/bsp/frdm-k82f/bsp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ bsp.url: https://www.nxp.com/design/design-center/development-boards-and-designs
bsp.maker: "NXP"
bsp.arch: cortex_m4
bsp.compiler: compiler/arm-none-eabi-m4
bsp.linkerscript: "hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld"
bsp.linkerscript.BOOT_LOADER.OVERWRITE: "hw/bsp/frdm-k82f/boot-MK82FN256xxx15_flash.ld"
bsp.linkerscript: autogenerated
bsp.downloadscript: "hw/bsp/frdm-k82f/frdm-k82_download.sh"
bsp.debugscript: "hw/bsp/frdm-k82f/frdm-k82_debug.sh"
bsp.downloadscript.WINDOWS.OVERWRITE: "hw/bsp/frdm-k82f/frdm-k82_download.cmd"
bsp.debugscript.WINDOWS.OVERWRITE: "hw/bsp/frdm-k82f/frdm-k82_debug.cmd"

bsp.flash_map:
areas:
Expand Down
22 changes: 0 additions & 22 deletions hw/bsp/frdm-k82f/frdm-k82_debug.cmd

This file was deleted.

22 changes: 0 additions & 22 deletions hw/bsp/frdm-k82f/frdm-k82_download.cmd

This file was deleted.

1 change: 1 addition & 0 deletions hw/bsp/frdm-k82f/pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pkg.cflags.HARDFLOAT:
pkg.deps:
- "@apache-mynewt-core/hw/mcu/nxp/kinetis/MK8xF/MK82F"
- "@apache-mynewt-core/libc"
- "@apache-mynewt-core/boot/startup"

pkg.deps.UART_0:
- "@apache-mynewt-core/hw/drivers/uart/uart_hal"
Expand Down
34 changes: 2 additions & 32 deletions hw/bsp/frdm-k82f/src/hal_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/types.h>
#include <stdio.h>
#include "os/mynewt.h"
#include "mynewt_cm.h"
#include "bsp/bsp.h"
#include "hal/hal_bsp.h"
#include "hal/hal_flash_int.h"
Expand Down Expand Up @@ -191,38 +192,6 @@ hal_bsp_power_state(int state)
return (0);
}

/*!
* @brief Function to override ARMGCC default function _sbrk
*
* _sbrk is called by malloc. ARMGCC default _sbrk compares "SP" register and
* heap end, if heap end is larger than "SP", then _sbrk returns error and
* memory allocation failed. This function changes to compare __HeapLimit with
* heap end.
*/
void *
_sbrk(int incr)
{
extern char end __asm("end");
extern char heap_limit __asm("__HeapLimit");
static char *heap_end;
char *prev_heap_end;

if (heap_end == NULL)
heap_end = &end;

prev_heap_end = heap_end;

if (heap_end + incr > &heap_limit)
{
errno = ENOMEM;
return (void *)-1;
}

heap_end += incr;

return (void *)prev_heap_end;
}

/**
* Returns the configured priority for the given interrupt. If no priority
* configured, return the priority passed in
Expand Down Expand Up @@ -352,4 +321,5 @@ hal_bsp_init(void)
void
hal_bsp_deinit(void)
{
Cortex_DisableAll();
}
5 changes: 2 additions & 3 deletions hw/bsp/frdm-k82f/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ syscfg.defs:
value: 1

syscfg.vals:
MCU_RAM_SIZE: 0x40000
MCU_RAM_START: 0x20000000
# Enabled by default, connected to CMSIS-DAP Interface
UART_4: 1
UART_4_PORT: PORTC
Expand Down Expand Up @@ -93,6 +95,3 @@ syscfg.vals:
CRYPTO_HW_AES_CTR: 1

BOOTUTIL_SWAP_USING_MOVE: 1

# BSP uses private version of _sbrk
HAL_SBRK: 0
212 changes: 0 additions & 212 deletions hw/mcu/nxp/kinetis/MK8xF/MK82F/src/system_MK82F25615.c

This file was deleted.

24 changes: 24 additions & 0 deletions hw/mcu/nxp/kinetis/MK8xF/include/mcu/mcu_vectors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

#ifdef CPU_MK82FN256VLL15
#include "vectors/mk82f25615_vectors.h"
#else
#error "Unknown device"
#endif
Loading

0 comments on commit 5e45350

Please sign in to comment.