Creating a microcontroller startup file
Jens Bauer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Apr 10 17:23:01 PDT 2015
On Thursday, 9 April 2015 at 10:47:42 UTC, Artur Skawina wrote:
>>> On Tuesday, 7 April 2015 at 20:33:26 UTC, Jens Bauer wrote:
>>
>> -It would be neat, if @attribute("weak") and
>> @attribute("alias","function") could be combined into one, but
>> I haven't found a way to do that
>
> http://forum.dlang.org/post/mailman.2672.1403379235.2907.digitalmars-d@puremagic.com
Thank you, Artur.
This is what I did (it's very close to the above; just slightly
modified):
enum weak = gcc.attribute.attribute("weak");
alias Tuple(A...) = A;
alias rst = Tuple!(weak, gcc.attribute.attribute("alias",
"defaultResetHandler"));
alias exc = Tuple!(weak, gcc.attribute.attribute("alias",
"defaultExceptionHandler"));
So now the code is much easier to read ...
@rst extern(C) void Reset_Handler();
@exc extern(C) void NMI_Handler();
@exc extern(C) void HardFault_Handler();
...
...
@exc extern(C) void LTDC_ER_IRQHandler();
@exc extern(C) void DMA2D_IRQHandler();
More information about the Digitalmars-d-learn
mailing list