Re: [riot-devel] RIOT vectors for Smartfusion2 port

2019-05-29 Thread Ashim Asharaph
Dear Juan and Hauke

Thank you for the suggestions.

To answer Juan's questions, I am not too sure about whether the vectors will 
change or not. It is likely but I might have to get a better understanding to 
know whether that is the case or not. The peripherals will definitely change 
though, depending on the FPGA configuration we use. We do have some ideas in 
mind on how to tackle this but they are not concrete yet.

To fix the dependency issue, I simply renamed the "startup_m2sxxx.S" file to 
"vectors.S". I am not too sure whether this completely solves the problem and 
is an acceptable fix or not, but hopefully that solves the problem.

Your help is much appreciated.

Kind regards
Ashim Asharaph




>>> Juan Ignacio Carrano  05/29/19 1:31 PM >>>
[The e-mail server of the sender could not be verified (SPF Record)]

Assim, Hauke,

To comment a bit on Hauke's suggestion.

On 29/5/19 08:47, Hauke Petersen wrote:
> The general approach for porting CPUs in RIOT is to rely as much as 
> possible on shared code...

That's very important, try to take advantage of what's already in RIOT.
  > . All the specific CPU
> implementations have to provide, are their interrupt vector structure 
> (see e.g. `cpu/samd21/vectors.c` or `cpu/stm32f4/vectors.c`), 

Hauke, The SmartFusion is integrated is integrated into a FPGA, so the 
vectors can change depending on how one programs it (am I right, Assim?)

It would be highly desirable if he does not have to translate the 
automatically generated assembly file into C. Specially considering it 
contains some platform-specific code (I see something about eSRAM EDAC 
and ECC mempory).

I think this is the piece of code that introduces the dependency on vectors:

https://github.com/RIOT-OS/RIOT/blob/7e3c382547430fae0a81e4f44c64d23e18629549/makefiles/arch/cortexm.inc.mk#L138

See the UNDEF. I may be wrong here, but I believe it is to prevent the 
symbols being dropped.

What you can do is either:

- Provide an empty vectors.c (to make the build system happy) AND add 
startup_m2sxxx.o to the UNDEF.

- Add a rule to build vectors.o from startup_m2sxxx.S AND also make sure
startup_m2sxxx.o does not get built.

Regards,

Juan.
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] RIOT vectors for Smartfusion2 port

2019-05-29 Thread Hauke Petersen

Hi Ashim,

the LPC2387 is unfortunately a very bad example, as this CPU is not very 
well maintained and does not comply with the best practices of structure 
and style that newer CPUs in RIOT use.


The general approach for porting CPUs in RIOT is to rely as much as 
possible on shared code. Keeping this in mind, all the needed startup 
code, base linker scripts, ... etc, are implemented and provided by the 
shared `cpu/cortexm_common` code path. All the specific CPU 
implementations have to provide, are their interrupt vector structure 
(see e.g. `cpu/samd21/vectors.c` or `cpu/stm32f4/vectors.c`), their 
memory layout (see e.g. `cpu/sam0_common/Makefile.include`), their clock 
initialization code (see e.g. `cpu/samd21/cpu.c`), and of course there 
peripheral driver implementations (typically in a `periph` subdir).


So with this, all you need is to extract that information above from the 
vendor libraries and you should be good to go!


Cheers,
Hauke


On 5/28/19 5:04 PM, Juan Ignacio Carrano wrote:

Hi Ashim,

I assume you are basing your SmartFusion port on some existing CPU. If 
that's the case, it would be useful to know which one. Even better if 
you can link us to a publicly accessible repo.


I have tried including this file in the new cpu folder I created but 
get the following error when trying to make:
arm-none-eabi-gcc: error: 
/home/user/Desktop/SmartFusion2/testjig/riot/2019.04/examples/hello-world/bin/sf2-starter-kit/cpu/vectors.o: 
No such file or directory




The first question is why the build system is expecting to find 
vectors.o. Not all CPUs generate that file (in your case you would 
compile startup_m2sxxx.S into startup_m2sxxx.o) I believe the answer 
to this question lies in the CPU you started with.


For example: you mention the LPC2387. If you compile any example with
BOARD=msba2 (which uses that cpu) and look inside "bin/msba2/cpu" you 
will not find any vectors.o and that's OK.


How do I use the above file correctly in the RIOT port? Is there some 
configuration that should be changed to use the file properly or 
should I convert it to a vectors.c file? If so, how do I go about 
doing so?




AFAIK you should not need to convert anything, just place the .S file 
in your CPU directory, but without knowing the full contents of the 
dir it is hard to tell what is happening.


Regards,

Juan.
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] RIOT vectors for Smartfusion2 port

2019-05-29 Thread Juan Ignacio Carrano

Assim, Hauke,

To comment a bit on Hauke's suggestion.

On 29/5/19 08:47, Hauke Petersen wrote:
The general approach for porting CPUs in RIOT is to rely as much as 
possible on shared code...


That's very important, try to take advantage of what's already in RIOT.
 > . All the specific CPU
implementations have to provide, are their interrupt vector structure 
(see e.g. `cpu/samd21/vectors.c` or `cpu/stm32f4/vectors.c`), 


Hauke, The SmartFusion is integrated is integrated into a FPGA, so the 
vectors can change depending on how one programs it (am I right, Assim?)


It would be highly desirable if he does not have to translate the 
automatically generated assembly file into C. Specially considering it 
contains some platform-specific code (I see something about eSRAM EDAC 
and ECC mempory).


I think this is the piece of code that introduces the dependency on vectors:

https://github.com/RIOT-OS/RIOT/blob/7e3c382547430fae0a81e4f44c64d23e18629549/makefiles/arch/cortexm.inc.mk#L138

See the UNDEF. I may be wrong here, but I believe it is to prevent the 
symbols being dropped.


What you can do is either:

- Provide an empty vectors.c (to make the build system happy) AND add 
startup_m2sxxx.o to the UNDEF.


- Add a rule to build vectors.o from startup_m2sxxx.S AND also make sure
startup_m2sxxx.o does not get built.

Regards,

Juan.
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


Re: [riot-devel] RIOT vectors for Smartfusion2 port

2019-05-29 Thread Ashim Asharaph
Dear Juan

The board is the sf2-starter-kit and the CPU is the m2s010, which contains a 
Cortex M3.


I have made a publicly accessible repo with all the code available at:
https://github.com/ashimasharaph/SmartFusion2_riot_port



I see now that the makefile in makefiles/arch/cortexm.inc.mk has the code


# Explicitly tell the linker to link the startup code.
#   Without this the interrupt vectors will not be linked correctly!
VECTORS_O ?= $(BINDIR)/cpu/vectors.o
ifeq ($(COMMON_STARTUP),)
export UNDEF += $(VECTORS_O)
endif


and the Makefile.include in the m2s_xxx cpu folder has:

include $(RIOTMAKE)/arch/cortexm.inc.mk



How should I go about removing that code and do I need to replace it with 
anything? Any help would be appreciated.


Kind regards
Ashim Asharaph





>>> Juan Ignacio Carrano  05/28/19 5:01 PM >>>
[The e-mail server of the sender could not be verified (SPF Record)]

Hi Ashim,

I assume you are basing your SmartFusion port on some existing CPU. If 
that's the case, it would be useful to know which one. Even better if 
you can link us to a publicly accessible repo.

> I have tried including this file in the new cpu folder I 
> created but get the following error when trying to make:
> arm-none-eabi-gcc: error: 
> /home/user/Desktop/SmartFusion2/testjig/riot/2019.04/examples/hello-world/bin/sf2-starter-kit/cpu/vectors.o:
>  
> No such file or directory
> 

The first question is why the build system is expecting to find 
vectors.o. Not all CPUs generate that file (in your case you would 
compile startup_m2sxxx.S into startup_m2sxxx.o) I believe the answer to 
this question lies in the CPU you started with.

For example: you mention the LPC2387. If you compile any example with
BOARD=msba2 (which uses that cpu) and look inside "bin/msba2/cpu" you 
will not find any vectors.o and that's OK.

> How do I use the above file correctly in the RIOT port? Is there some 
> configuration that should be changed to use the file properly or should 
> I convert it to a vectors.c file? If so, how do I go about doing so?
> 

AFAIK you should not need to convert anything, just place the .S file in 
your CPU directory, but without knowing the full contents of the dir it 
is hard to tell what is happening.

Regards,

Juan.
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel


[riot-devel] RIOT vectors for Smartfusion2 port

2019-05-28 Thread Ashim Asharaph
Dear RIOT Developers

I am currently working on a port for RIOT to the Microsemi SmartFusion2 board 
which has a Cortex M3. I see that most of the CPUs have a vectors.c file which 
specify all the interrupt vectors. Some of the other boards have an assembly 
file for startup such as the lpc2387 which define the interrupt vectors. I have 
attached an assembly file that is generated by some Microsemi software which 
defines the interrupt vectors. I have tried including this file in the new cpu 
folder I created but get the following error when trying to make:
arm-none-eabi-gcc: error: 
/home/user/Desktop/SmartFusion2/testjig/riot/2019.04/examples/hello-world/bin/sf2-starter-kit/cpu/vectors.o:
 No such file or directory

How do I use the above file correctly in the RIOT port? Is there some 
configuration that should be changed to use the file properly or should I 
convert it to a vectors.c file? If so, how do I go about doing so?


Kind regards
Ashim Asharaph




startup_m2sxxx.S
Description: Binary data
___
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel