From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1770 invoked by alias); 2 Dec 2012 10:12:57 -0000 Received: (qmail 1757 invoked by uid 22791); 2 Dec 2012 10:12:56 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from tirion.supremecenter202.com (HELO tirion.supremecenter202.com) (209.25.195.243) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 02 Dec 2012 10:12:52 +0000 Received: from [195.189.206.101] (port=51010 helo=[192.168.209.11]) by tirion.supremecenter202.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1Tf6Xa-0000ww-4O; Sun, 02 Dec 2012 10:12:50 +0000 Message-ID: <50BB299F.5070404@siva.com.mk> Date: Sun, 02 Dec 2012 10:12:00 -0000 From: Ilija Kocho User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Michael Jones CC: eCos Discussion References: <88A5F92E-1AE1-4246-B566-3EFE5DEA360B@linear.com> In-Reply-To: <88A5F92E-1AE1-4246-B566-3EFE5DEA360B@linear.com> Content-Type: multipart/mixed; boundary="------------060107070803080100060305" X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Kinetis CYG_HAL_STARTUP_VAR conflict X-SW-Source: 2012-12/txt/msg00005.txt.bz2 --------------060107070803080100060305 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 2327 Hi Mike On 01.12.2012 22:07, Michael Jones wrote: > BACKGROUND > ---------------------- > > I am having a little bit of trouble trying to get my first hello world app on a K60 Tower Board. > > I have RedBoot running from ROM and I can ping the ethernet port, so presumably I will eventually get GDB to talk to it. > > I am having trouble building an initial app that uses the ROM monitor. Following the example in the eCos book, I went hunting for CYGSEM_HAL_USE_ROM_MONITOR, enabled it and then set startup to SRAM. This seems the obvious way to run and debug. > > PROBLEM > -------------- > > I am getting a conflict I don't know how to resolve. I have set CYG_HAL_STARTUP_VAR = SRAM. This results in CYG_HAL_STARTUP = SRAM by calculation. > > But I get a conflict from CYGSEM_HAL_USE_ROM_MONITOR that wants CYG_HAL_STARTUP == RAM SRAM and RAM startups are not the same. RAM startup is intended for using under control of RedBoot and has some special properties: RAM, unlike other startup types uses RedBoot's vectors, etc... SRAM startup is kind of "stand-alone" in a way it does not depend on RedBoot (but depends on JTAG debugger) > QUESTIONS > ----------------- > > 1) Can I ignore this conflict and get the monitor and app to work? I'm afraid not because, SRAM startup collides with RedBoot. > > 2) Is there a better approach? The right approach is to create RAM startup. It could live on variant level and be available to all Kinetis platforms (though some may have too little memory to utilize it). The attached patches should produce proper variant-level RAM startup. I did not add it from beginning since I consider internal SRAM too little for practical work, seems that other people have different view. You are not the first to look for. This being said, I am considering to add this startup to the main repository. Would you open a Bug on Bugzilla? > > 3) Has anyone succeeded to use RedBoot on the K60 and can you supply an example config project that works that I can look at? You may want to try this: http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001623 but beware, it is experimental, and at present it may be broken as it's not synced with recent Kinetis patches. Take care not to lock your Kinetis flash - You have been warned :) I hope this helps and I would appreciate feedback. Regards Ilija --------------060107070803080100060305 Content-Type: text/x-patch; name="kinetis_var_ram-startup_cdl_121202.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kinetis_var_ram-startup_cdl_121202.diff" Content-length: 1331 diff -ruN -x CVS -x '.*' ecos/packages/hal/cortexm/kinetis/var/current/cdl/hal_cortexm_kinetis.cdl ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/cdl/hal_cortexm_kinetis.cdl --- ecos/packages/hal/cortexm/kinetis/var/current/cdl/hal_cortexm_kinetis.cdl 2012-11-03 17:13:05.953836177 +0100 +++ ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/cdl/hal_cortexm_kinetis.cdl 2012-12-01 22:37:50.159462935 +0100 @@ -209,7 +209,7 @@ parent CYG_HAL_STARTUP_ENV default_value { (CYG_HAL_STARTUP_PLF) && (CYG_HAL_STARTUP_PLF!="ByVariant") ? "ByPlatform" : "ROM" } - legal_values { "ROM" "SRAM" } + legal_values { "ROM" "SRAM" "RAM" } active_if ((!CYG_HAL_STARTUP_PLF) || (CYG_HAL_STARTUP_PLF=="ByVariant")) description " 'ROM' startup builds a stand-alone application which will @@ -340,6 +340,8 @@ . CYGHWR_HAL_CORTEXM_KINETIS_OC_MEM_LAYOUT . "_rom" : (CYG_HAL_STARTUP == "SRAM") ? "kinetis_" . CYGHWR_HAL_CORTEXM_KINETIS_OC_MEM_LAYOUT . "_sram" : + (CYG_HAL_STARTUP == "RAM") ? "kinetis_" + . CYGHWR_HAL_CORTEXM_KINETIS_OC_MEM_LAYOUT . "_ram" : "undefined" } description " Combination of 'Startup type' and 'Kinetis part' --------------060107070803080100060305 Content-Type: text/x-patch; name="kinetis_var_ram-startup_mlt_121202.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kinetis_var_ram-startup_mlt_121202.diff" Content-length: 2985 diff -ruN -x CVS -x '.*' ecos/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.h ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.h --- ecos/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.h 1970-01-01 01:00:00.000000000 +0100 +++ ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.h 2012-12-01 22:39:30.267467079 +0100 @@ -0,0 +1,18 @@ +// eCos memory layout + +#ifndef __ASSEMBLER__ +#include +#include + +#endif +#define CYGMEM_REGION_ram (0x20000000 - CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE) +#define CYGMEM_REGION_ram_SIZE (CYGHWR_HAL_KINETIS_SRAM_SIZE-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; +#endif +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) +#define CYGMEM_SECTION_heap1_SIZE (CYGMEM_REGION_ram+CYGMEM_REGION_ram_SIZE - (size_t) CYG_LABEL_NAME (__heap1)) + + diff -ruN -x CVS -x '.*' ecos/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.ldi ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.ldi --- ecos/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.ldi 1970-01-01 01:00:00.000000000 +0100 +++ ecos_kin_jones/packages/hal/cortexm/kinetis/var/current/include/pkgconf/mlt_kinetis_flash_unisram_ram.ldi 2012-12-02 10:23:47.950382495 +0100 @@ -0,0 +1,34 @@ +// eCos memory layout + +#include +#include + +MEMORY +{ + ram : ORIGIN = 0x20000000 - CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE, LENGTH = CYGHWR_HAL_KINETIS_SRAM_SIZE-CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + flash : ORIGIN = 0x00000000, LENGTH = CYGHWR_HAL_KINETIS_FLASH_SIZE +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x20000400 - CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE + 0xe000, LMA_EQ_VMA) + SECTION_RELOCS (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_eh_frame (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_got (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_sram (ram, ALIGN (0x8), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x8), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + +hal_vsr_table = (0x20000000 - CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE); +hal_virtual_vector_table = hal_vsr_table + 128*4; +hal_startup_stack = 0x20000000 + CYGHWR_HAL_KINETIS_SRAM_BANK_SIZE; --------------060107070803080100060305 Content-Type: text/plain; charset=us-ascii Content-length: 148 -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss --------------060107070803080100060305--