Provide mynewt_main in linker scripts
diff --git a/hw/bsp/frdm-k64f/MK64FN1M0xxx12_flash.ld b/hw/bsp/frdm-k64f/MK64FN1M0xxx12_flash.ld
index a14123a..a3276b2 100644
--- a/hw/bsp/frdm-k64f/MK64FN1M0xxx12_flash.ld
+++ b/hw/bsp/frdm-k64f/MK64FN1M0xxx12_flash.ld
@@ -104,6 +104,7 @@
     KEEP (*(.init))
     KEEP (*(.fini))
     . = ALIGN(4);
+    PROVIDE(mynewt_main = main);
   } > FLASH
 
   .ARM.extab :
diff --git a/hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld b/hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld
index 55aace4..ccf5b65 100644
--- a/hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld
+++ b/hw/bsp/frdm-k82f/MK82FN256xxx15_flash.ld
@@ -73,6 +73,7 @@
     KEEP (*(.init))
     KEEP (*(.fini))
     . = ALIGN(4);
+    PROVIDE(mynewt_main = main);
   } > FLASH
 
   .ARM.extab :
diff --git a/hw/bsp/hifive1/hifive1.ld b/hw/bsp/hifive1/hifive1.ld
index 40ff08b..accf18a 100644
--- a/hw/bsp/hifive1/hifive1.ld
+++ b/hw/bsp/hifive1/hifive1.ld
@@ -42,6 +42,7 @@
     *(.text.startup .text.startup.*)
     *(.text .text.*)
     *(.gnu.linkonce.t.*)
+    PROVIDE(mynewt_main = main);
   } >flash
 
   .fini           :
diff --git a/hw/bsp/usbmkw41z/boot-mkw41z512.ld b/hw/bsp/usbmkw41z/boot-mkw41z512.ld
index 58612c7..99c766a 100644
--- a/hw/bsp/usbmkw41z/boot-mkw41z512.ld
+++ b/hw/bsp/usbmkw41z/boot-mkw41z512.ld
@@ -101,6 +101,7 @@
 

         *(.eh_frame*)

         . = ALIGN(4);

+        PROVIDE(mynewt_main = main);

     } > FLASH

 

     .ARM.extab :

diff --git a/hw/bsp/usbmkw41z/mkw41z512.ld b/hw/bsp/usbmkw41z/mkw41z512.ld
index e07d64f..491a1ac 100644
--- a/hw/bsp/usbmkw41z/mkw41z512.ld
+++ b/hw/bsp/usbmkw41z/mkw41z512.ld
@@ -91,6 +91,7 @@
 

         *(.eh_frame*)

         . = ALIGN(4);

+        PROVIDE(mynewt_main = main);

     } > FLASH

 

     .ARM.extab :

diff --git a/hw/bsp/usbmkw41z/no-boot-mkw41z512.ld b/hw/bsp/usbmkw41z/no-boot-mkw41z512.ld
index 9889c0f..6dff114 100644
--- a/hw/bsp/usbmkw41z/no-boot-mkw41z512.ld
+++ b/hw/bsp/usbmkw41z/no-boot-mkw41z512.ld
@@ -101,6 +101,7 @@
 

         *(.eh_frame*)

         . = ALIGN(4);

+        PROVIDE(mynewt_main = main);

     } > FLASH

 

     .ARM.extab :

diff --git a/hw/mcu/ambiq/apollo2/apollo2.ld b/hw/mcu/ambiq/apollo2/apollo2.ld
index 7ab6323..3c15b58 100644
--- a/hw/mcu/ambiq/apollo2/apollo2.ld
+++ b/hw/mcu/ambiq/apollo2/apollo2.ld
@@ -83,6 +83,7 @@
 
         *(.eh_frame*)
         . = ALIGN(4);
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
 
diff --git a/hw/mcu/ambiq/apollo3/apollo3.ld b/hw/mcu/ambiq/apollo3/apollo3.ld
index 4dfc537..b2f3083 100644
--- a/hw/mcu/ambiq/apollo3/apollo3.ld
+++ b/hw/mcu/ambiq/apollo3/apollo3.ld
@@ -46,6 +46,7 @@
     *(.rodata)
     *(.rodata*)
 
+    PROVIDE(mynewt_main = main);
     . = ALIGN(4);
   } > FLASH
 
@@ -149,4 +150,4 @@
 
   /* Check if data + heap + stack exceeds RAM limit */
   ASSERT(__HeapBase <= __HeapLimit, "region RAM overflowed with stack")
-}
\ No newline at end of file
+}
diff --git a/hw/mcu/dialog/da1469x/da1469x.ld b/hw/mcu/dialog/da1469x/da1469x.ld
index e1ff354..9f1e29b 100644
--- a/hw/mcu/dialog/da1469x/da1469x.ld
+++ b/hw/mcu/dialog/da1469x/da1469x.ld
@@ -109,6 +109,7 @@
 
         *(.eh_frame*)
         . = ALIGN(4);
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/dialog/da1469x/da1469x_ram_resident.ld b/hw/mcu/dialog/da1469x/da1469x_ram_resident.ld
index b12dac4..0caf676 100644
--- a/hw/mcu/dialog/da1469x/da1469x_ram_resident.ld
+++ b/hw/mcu/dialog/da1469x/da1469x_ram_resident.ld
@@ -73,6 +73,7 @@
 
         *(.eh_frame*)
         . = ALIGN(4);
+        PROVIDE(mynewt_main = main);
     } > RAM
 
     .ARM.extab :
diff --git a/hw/mcu/nordic/nrf51xxx/nrf51.ld b/hw/mcu/nordic/nrf51xxx/nrf51.ld
index 5507081..ea89e0f 100644
--- a/hw/mcu/nordic/nrf51xxx/nrf51.ld
+++ b/hw/mcu/nordic/nrf51xxx/nrf51.ld
@@ -102,6 +102,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > FLASH
 
diff --git a/hw/mcu/nordic/nrf52xxx/nrf52.ld b/hw/mcu/nordic/nrf52xxx/nrf52.ld
index f3f8b4c..af7de10 100644
--- a/hw/mcu/nordic/nrf52xxx/nrf52.ld
+++ b/hw/mcu/nordic/nrf52xxx/nrf52.ld
@@ -102,6 +102,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > FLASH
 
diff --git a/hw/mcu/nordic/nrf52xxx/nrf52_ram_resident.ld b/hw/mcu/nordic/nrf52xxx/nrf52_ram_resident.ld
index 1819bd3..f482248 100644
--- a/hw/mcu/nordic/nrf52xxx/nrf52_ram_resident.ld
+++ b/hw/mcu/nordic/nrf52xxx/nrf52_ram_resident.ld
@@ -98,6 +98,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > RAM
 
diff --git a/hw/mcu/nordic/nrf5340/nrf5340.ld b/hw/mcu/nordic/nrf5340/nrf5340.ld
index e29139a..d8e27e7 100644
--- a/hw/mcu/nordic/nrf5340/nrf5340.ld
+++ b/hw/mcu/nordic/nrf5340/nrf5340.ld
@@ -102,6 +102,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > FLASH
 
diff --git a/hw/mcu/nordic/nrf5340/nrf5340_ram_resident.ld b/hw/mcu/nordic/nrf5340/nrf5340_ram_resident.ld
index 3f1d89c..05dfd46 100644
--- a/hw/mcu/nordic/nrf5340/nrf5340_ram_resident.ld
+++ b/hw/mcu/nordic/nrf5340/nrf5340_ram_resident.ld
@@ -98,6 +98,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > RAM
 
diff --git a/hw/mcu/nordic/nrf5340_net/nrf5340_net.ld b/hw/mcu/nordic/nrf5340_net/nrf5340_net.ld
index 9a64264..f235d6d 100644
--- a/hw/mcu/nordic/nrf5340_net/nrf5340_net.ld
+++ b/hw/mcu/nordic/nrf5340_net/nrf5340_net.ld
@@ -102,6 +102,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > FLASH
 
diff --git a/hw/mcu/nordic/nrf5340_net/nrf5340_net_ram_resident.ld b/hw/mcu/nordic/nrf5340_net/nrf5340_net_ram_resident.ld
index 1819bd3..f482248 100644
--- a/hw/mcu/nordic/nrf5340_net/nrf5340_net_ram_resident.ld
+++ b/hw/mcu/nordic/nrf5340_net/nrf5340_net_ram_resident.ld
@@ -98,6 +98,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > RAM
 
diff --git a/hw/mcu/nordic/nrf91xx/nrf91.ld b/hw/mcu/nordic/nrf91xx/nrf91.ld
index f3f8b4c..af7de10 100644
--- a/hw/mcu/nordic/nrf91xx/nrf91.ld
+++ b/hw/mcu/nordic/nrf91xx/nrf91.ld
@@ -102,6 +102,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > FLASH
 
diff --git a/hw/mcu/nordic/nrf91xx/nrf91_ram_resident.ld b/hw/mcu/nordic/nrf91xx/nrf91_ram_resident.ld
index 1819bd3..f482248 100644
--- a/hw/mcu/nordic/nrf91xx/nrf91_ram_resident.ld
+++ b/hw/mcu/nordic/nrf91xx/nrf91_ram_resident.ld
@@ -98,6 +98,7 @@
         *(.rodata*)
 
         *(.eh_frame*)
+        PROVIDE(mynewt_main = main);
         . = ALIGN(4);
     } > RAM
 
diff --git a/hw/mcu/stm/stm32f0xx/stm32f0xx.ld b/hw/mcu/stm/stm32f0xx/stm32f0xx.ld
index 997c6de..a9602ac 100644
--- a/hw/mcu/stm/stm32f0xx/stm32f0xx.ld
+++ b/hw/mcu/stm/stm32f0xx/stm32f0xx.ld
@@ -110,6 +110,7 @@
         *(.rodata*)

 

         KEEP(*(.eh_frame*))

+        PROVIDE(mynewt_main = main);

     } > FLASH

 

     .ARM.extab :

diff --git a/hw/mcu/stm/stm32f1xx/stm32f103.ld b/hw/mcu/stm/stm32f1xx/stm32f103.ld
index 5e0b497..5a646e5 100644
--- a/hw/mcu/stm/stm32f1xx/stm32f103.ld
+++ b/hw/mcu/stm/stm32f1xx/stm32f103.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f3xx/stm32f303.ld b/hw/mcu/stm/stm32f3xx/stm32f303.ld
index bf89bb4..b7ee776 100644
--- a/hw/mcu/stm/stm32f3xx/stm32f303.ld
+++ b/hw/mcu/stm/stm32f3xx/stm32f303.ld
@@ -111,6 +111,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f401.ld b/hw/mcu/stm/stm32f4xx/stm32f401.ld
index 75fc436..40a35de 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f401.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f401.ld
@@ -108,6 +108,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f407.ld b/hw/mcu/stm/stm32f4xx/stm32f407.ld
index 1943af6..51eaa3b 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f407.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f407.ld
@@ -108,6 +108,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f411.ld b/hw/mcu/stm/stm32f4xx/stm32f411.ld
index 75fc436..40a35de 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f411.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f411.ld
@@ -108,6 +108,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f413.ld b/hw/mcu/stm/stm32f4xx/stm32f413.ld
index ab253af..7615341 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f413.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f413.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f427.ld b/hw/mcu/stm/stm32f4xx/stm32f427.ld
index 1943af6..51eaa3b 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f427.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f427.ld
@@ -108,6 +108,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f429.ld b/hw/mcu/stm/stm32f4xx/stm32f429.ld
index 134ab0d..e473e33 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f429.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f429.ld
@@ -111,6 +111,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f4xx/stm32f439.ld b/hw/mcu/stm/stm32f4xx/stm32f439.ld
index 134ab0d..e473e33 100644
--- a/hw/mcu/stm/stm32f4xx/stm32f439.ld
+++ b/hw/mcu/stm/stm32f4xx/stm32f439.ld
@@ -111,6 +111,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f7xx/stm32f746.ld b/hw/mcu/stm/stm32f7xx/stm32f746.ld
index f0a430e..2b017b4 100644
--- a/hw/mcu/stm/stm32f7xx/stm32f746.ld
+++ b/hw/mcu/stm/stm32f7xx/stm32f746.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32f7xx/stm32f767.ld b/hw/mcu/stm/stm32f7xx/stm32f767.ld
index f0a430e..2b017b4 100644
--- a/hw/mcu/stm/stm32f7xx/stm32f767.ld
+++ b/hw/mcu/stm/stm32f7xx/stm32f767.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32h7xx/stm32h723.ld b/hw/mcu/stm/stm32h7xx/stm32h723.ld
index 54a43b5..2e41eed 100644
--- a/hw/mcu/stm/stm32h7xx/stm32h723.ld
+++ b/hw/mcu/stm/stm32h7xx/stm32h723.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32l0xx/stm32l072.ld b/hw/mcu/stm/stm32l0xx/stm32l072.ld
index 8e62759..15b0a80 100644
--- a/hw/mcu/stm/stm32l0xx/stm32l072.ld
+++ b/hw/mcu/stm/stm32l0xx/stm32l072.ld
@@ -109,6 +109,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32l0xx/stm32l073.ld b/hw/mcu/stm/stm32l0xx/stm32l073.ld
index 8e62759..15b0a80 100644
--- a/hw/mcu/stm/stm32l0xx/stm32l073.ld
+++ b/hw/mcu/stm/stm32l0xx/stm32l073.ld
@@ -109,6 +109,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32l1xx/stm32l152.ld b/hw/mcu/stm/stm32l1xx/stm32l152.ld
index 5e0b497..5a646e5 100644
--- a/hw/mcu/stm/stm32l1xx/stm32l152.ld
+++ b/hw/mcu/stm/stm32l1xx/stm32l152.ld
@@ -110,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32l4xx/stm32l476.ld b/hw/mcu/stm/stm32l4xx/stm32l476.ld
index 26f8176..e0b6bf2 100644
--- a/hw/mcu/stm/stm32l4xx/stm32l476.ld
+++ b/hw/mcu/stm/stm32l4xx/stm32l476.ld
@@ -109,6 +109,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32u5xx/stm32u5xx.ld b/hw/mcu/stm/stm32u5xx/stm32u5xx.ld
index 26f8176..e0b6bf2 100644
--- a/hw/mcu/stm/stm32u5xx/stm32u5xx.ld
+++ b/hw/mcu/stm/stm32u5xx/stm32u5xx.ld
@@ -109,6 +109,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
diff --git a/hw/mcu/stm/stm32wbxx/stm32wb55.ld b/hw/mcu/stm/stm32wbxx/stm32wb55.ld
index c408dea..bc61dc0 100644
--- a/hw/mcu/stm/stm32wbxx/stm32wb55.ld
+++ b/hw/mcu/stm/stm32wbxx/stm32wb55.ld
@@ -1,54 +1,59 @@
-/**
-*****************************************************************************
-**
-**  File        : stm32wb55xx_flash_cm4.ld
-**
-**  Abstract    : System Workbench Minimal System calls file
-**
-** 		          For more information about which c-functions
-**                need which of these lowlevel functions
-**                please consult the Newlib libc-manual
-**
-**  Environment : System Workbench for MCU
-**
-**  Distribution: The file is distributed “as is,” without any warranty
-**                of any kind.
-**
-*****************************************************************************
-**
-** <h2><center>&copy; COPYRIGHT(c) 2019 Ac6</center></h2>
-**
-** 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 of Ac6 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 HOLDER 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.
-**
-*****************************************************************************
-*/
+/*
+ * 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.
+ */
 
-/* Entry Point */
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ *   Reset_Handler : Entry of reset handler
+ *
+ * It defines following symbols, which code can use without definition:
+ *   __exidx_start
+ *   __exidx_end
+ *   __etext
+ *   __data_start__
+ *   __preinit_array_start
+ *   __preinit_array_end
+ *   __init_array_start
+ *   __init_array_end
+ *   __fini_array_start
+ *   __fini_array_end
+ *   __data_end__
+ *   __bss_start__
+ *   __bss_end__
+ *   __end__
+ *   end
+ *   __HeapBase
+ *   __HeapLimit
+ *   __StackLimit
+ *   __StackTop
+ *   __stack
+ *   __coredata_start__
+ *   __coredata_end__
+ *   __corebss_start__
+ *   __corebss_end__
+ *   __ecoredata
+ *   __ecorebss
+ */
 ENTRY(Reset_Handler)
 
 _estack = ORIGIN(RAM) + LENGTH(RAM);
 
-/* Define output sections */
 SECTIONS
 {
     /* Reserve space at the start of the image for the header. */
@@ -57,9 +62,10 @@
         . = . + _imghdr_size;
     } > FLASH
 
+    __text = .;
+
     .text :
     {
-        . = ALIGN(8);
         __isr_vector_start = .;
         KEEP(*(.isr_vector))
         __isr_vector_end = .;
@@ -73,14 +79,14 @@
         KEEP(*(.preinit_array))
         PROVIDE_HIDDEN (__preinit_array_end = .);
 
-        . = ALIGN(8);
+        . = ALIGN(4);
         /* init data */
         PROVIDE_HIDDEN (__init_array_start = .);
         KEEP(*(SORT(.init_array.*)))
         KEEP(*(.init_array))
         PROVIDE_HIDDEN (__init_array_end = .);
 
-        . = ALIGN(8);
+        . = ALIGN(4);
         /* finit data */
         PROVIDE_HIDDEN (__fini_array_start = .);
         KEEP(*(SORT(.fini_array.*)))
@@ -104,6 +110,7 @@
         *(.rodata*)
 
         KEEP(*(.eh_frame*))
+        PROVIDE(mynewt_main = main);
     } > FLASH
 
     .ARM.extab :
@@ -123,16 +130,17 @@
 
     .vector_relocation :
     {
-        . = ALIGN(8);
+        . = ALIGN(4);
         __vector_tbl_reloc__ = .;
         . = . + (__isr_vector_end - __isr_vector_start);
+        . = ALIGN(4);
     } > RAM
 
     .coredata :
     {
-        . = ALIGN(8);
         __coredata_start__ = .;
         *(.data.core)
+        . = ALIGN(4);
         __coredata_end__ = .;
     } > RAM AT > FLASH
 
@@ -142,14 +150,14 @@
 
     .data :
     {
-        . = ALIGN(8);
+        . = ALIGN(4);
         _sdata = .;
         __data_start__ = _sdata;
         *(vtable)
         *(.data*)
 
         KEEP(*(.jcr*))
-        . = ALIGN(8);
+        . = ALIGN(4);
         /* All data end */
         _edata = .;
         __data_end__ = _edata;
diff --git a/libc/baselibc/pkg.yml b/libc/baselibc/pkg.yml
index b751946..ee7ff01 100644
--- a/libc/baselibc/pkg.yml
+++ b/libc/baselibc/pkg.yml
@@ -36,3 +36,4 @@
 
 pkg.lflags:
     - -specs=nosys.specs:
+    - -umain