You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2015/11/14 02:32:52 UTC
[2/4] incubator-mynewt-larva git commit: Add flash map for native.
Add flash map for native.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/8554d6a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/8554d6a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/8554d6a7
Branch: refs/heads/master
Commit: 8554d6a7d8d1cc17e7b4f3a2bac21c9d803ec99c
Parents: 96f4fdf
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Nov 13 17:27:14 2015 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Nov 13 17:27:14 2015 -0800
----------------------------------------------------------------------
hw/bsp/native/src/os_bsp.c | 47 +++++++++++++++++++++++++++
libs/os/include/os/arch/sim/os/os_arch.h | 2 ++
libs/os/src/arch/sim/os_arch_sim.c | 5 ++-
3 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8554d6a7/hw/bsp/native/src/os_bsp.c
----------------------------------------------------------------------
diff --git a/hw/bsp/native/src/os_bsp.c b/hw/bsp/native/src/os_bsp.c
new file mode 100644
index 0000000..a632c86
--- /dev/null
+++ b/hw/bsp/native/src/os_bsp.c
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2015 Runtime Inc.
+ *
+ * Licensed 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.
+ */
+#include <util/flash_map.h>
+
+static struct flash_area bsp_flash_areas[] = {
+ [FLASH_AREA_BOOTLOADER] = {
+ .fa_flash_id = 0, /* internal flash */
+ .fa_off = 0x00000000, /* beginning */
+ .fa_size = (32 * 1024)
+ },
+ /* 2 * 16K and 1*64K sectors here */
+ [FLASH_AREA_IMAGE_0] = {
+ .fa_flash_id = 0,
+ .fa_off = 0x00020000,
+ .fa_size = (384 * 1024)
+ },
+ [FLASH_AREA_IMAGE_1] = {
+ .fa_flash_id = 0,
+ .fa_off = 0x00080000,
+ .fa_size = (384 * 1024)
+ },
+ [FLASH_AREA_IMAGE_SCRATCH] = {
+ .fa_flash_id = 0,
+ .fa_off = 0x000e0000,
+ .fa_size = (128 * 1024)
+ }
+};
+
+void os_bsp_init(void)
+{
+ flash_area_init(bsp_flash_areas,
+ sizeof(bsp_flash_areas) / sizeof(bsp_flash_areas[0]));
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8554d6a7/libs/os/include/os/arch/sim/os/os_arch.h
----------------------------------------------------------------------
diff --git a/libs/os/include/os/arch/sim/os/os_arch.h b/libs/os/include/os/arch/sim/os/os_arch.h
index 7144a44..3466727 100644
--- a/libs/os/include/os/arch/sim/os/os_arch.h
+++ b/libs/os/include/os/arch/sim/os/os_arch.h
@@ -60,4 +60,6 @@ void os_arch_restore_sr(int);
os_error_t os_arch_os_init(void);
os_error_t os_arch_os_start(void);
+void os_bsp_init(void);
+
#endif /* _OS_ARCH_SIM_H */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/8554d6a7/libs/os/src/arch/sim/os_arch_sim.c
----------------------------------------------------------------------
diff --git a/libs/os/src/arch/sim/os_arch_sim.c b/libs/os/src/arch/sim/os_arch_sim.c
index 5d2bfe6..f2d57e3 100644
--- a/libs/os/src/arch/sim/os_arch_sim.c
+++ b/libs/os/src/arch/sim/os_arch_sim.c
@@ -308,7 +308,10 @@ os_arch_os_init(void)
TAILQ_INIT(&g_os_sleep_list);
os_init_idle_task();
- os_sanity_task_init();
+ os_sanity_task_init();
+
+ os_bsp_init();
+
return OS_OK;
}