forked from Archive/PX4-Autopilot
Fix UAVCAN bootloader builds broken by os calls from stm32_flash
Recent upsteam NuttX changes needed by PX4 added sem_[wait|post] in the stm32_flash driver. UAVCAN Bootloaders do not use the OS's scheduler etal. This commit nops the sem_[wait|post] with linker magic. Which precludes the linking the nuttx scheduler in the bootloader build.
This commit is contained in:
parent
5c6264ae35
commit
78e2a293d2
|
@ -0,0 +1,89 @@
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* Copyright (c) 2017 PX4 Development Team. All rights reserved.
|
||||||
|
* Author: David Sidrane <david_s5@nscdg.com>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 3. Neither the name PX4 nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
__EXPORT int __wrap_sem_wait(void *sem);
|
||||||
|
__EXPORT int __wrap_sem_post(void *sem);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: sem_wait and sem_post
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* These functions hijacks by the way of a compile time wrapper the systems
|
||||||
|
* sem_wait and sem_post functions.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int __wrap_sem_wait(void *sem)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __wrap_sem_post(void *sem)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -29,7 +29,7 @@ set(startup_libs)
|
||||||
if("${config_nuttx_config}" STREQUAL "bootloader")
|
if("${config_nuttx_config}" STREQUAL "bootloader")
|
||||||
set(nuttx_ld_prefix "bootloader")
|
set(nuttx_ld_prefix "bootloader")
|
||||||
set(nuttx_startup_files ${nuttx_export_dir}/startup/${nuttx_startup_files})
|
set(nuttx_startup_files ${nuttx_export_dir}/startup/${nuttx_startup_files})
|
||||||
set(nuttx_bootloader_wrapers "-Wl,-wrap,sched_process_timer")
|
set(nuttx_bootloader_wrapers "-Wl,-wrap,sched_process_timer -Wl,-wrap,sem_post -Wl,-wrap,sem_wait")
|
||||||
|
|
||||||
add_custom_command(OUTPUT
|
add_custom_command(OUTPUT
|
||||||
${nuttx_startup_files}
|
${nuttx_startup_files}
|
||||||
|
|
Loading…
Reference in New Issue